6.12.0 • Published 5 months ago

@ledgerhq/logs v6.12.0

Weekly downloads
35,742
License
Apache-2.0
Repository
github
Last release
5 months ago

@ledgerhq/logs

Utility library that is used by all Ledger libraries to dispatch logs so we can deal with them in a unified way.

API

Table of Contents

Log

A Log object

type

A namespaced identifier of the log (not a level like "debug", "error" but more like "apdu", "hw", etc...)

Type: LogType

data

Data associated to the log event

Type: LogData

context

Context data, coming for example from the caller's parent, to enable a simple tracing system

Type: TraceContext

id

Unique id among all logs

Type: string

log

Logs something

Parameters

  • type LogType a namespaced identifier of the log (it is not a level like "debug", "error" but more like "apdu-in", "apdu-out", etc...)
  • message string? a clear message of the log associated to the type
  • data LogData?

trace

A simple tracer function, only expanding the existing log function

Its goal is to capture more context than a log function. This is simple for now, but can be improved later.

Parameters

  • context {type: LogType, message: string?, data: LogData?, context: TraceContext?} Anything representing the context where the log occurred

    • context.type
    • context.message
    • context.data
    • context.context

LocalTracer

A simple tracer class, that can be used to avoid repetition when using the trace function

Its goal is to capture more context than a log function. This is simple for now, but can be improved later.

Parameters

  • type A given type (not level) for the current local tracer ("hw", "withDevice", etc.)
  • context Anything representing the context where the log occurred

withType

Create a new instance of the LocalTracer with an updated type

It does not mutate the calling instance, but returns a new LocalTracer, following a simple builder pattern.

Parameters
  • type LogType

Returns LocalTracer

withContext

Create a new instance of the LocalTracer with a new context

It does not mutate the calling instance, but returns a new LocalTracer, following a simple builder pattern.

Parameters
  • context TraceContext? A TraceContext, that can undefined to reset the context

Returns LocalTracer

withUpdatedContext

Create a new instance of the LocalTracer with an updated context, on which an additional context is merged with the existing one.

It does not mutate the calling instance, but returns a new LocalTracer, following a simple builder pattern.

Parameters
  • contextToAdd TraceContext

Returns LocalTracer

listen

Adds a subscribers to the emitted logs.

Parameters

  • cb Subscriber that is called for each future log() with the Log object

Returns Unsubscribe a function that can be called to unsubscribe the listener

@ledgerhq/live-cli@ledgerhq/live-common@ledgerhq/hw-app-eth@everything-registry/sub-chunk-540paras-wallet-selectorparas-wallet-selector-here-wallethw-app-dfihw-transport-node-speculos-httphw-ledger-provideridena-jsnear-wallet-selectorledger-liveledger-xtzdecimal-js-sdk@blooo/hw-app-velaswallet-btc@pollum-io/sysweb3-keyring@pocketbitcoin/hw-app-btc@openocean.finance/wallet@iotexproject/hw-transport-node-hid@owdin/live-common@ledgerhq/hw-transport-webusb@ledgerhq/live-countervalues@ledgerhq/live-countervalues-react@ledgerhq/live-network@ledgerhq/hw-transport@ledgerhq/hw-transport-http@ledgerhq/hw-transport-mocker@ledgerhq/live-promise@ledgerhq/hw-transport-node-speculos@ledgerhq/hw-transport-node-speculos-http@ledgerhq/hw-transport-u2f@ledgerhq/hw-transport-vault@ledgerhq/hw-transport-node-ble@ledgerhq/hw-transport-node-hid@ledgerhq/hw-app-vet@ledgerhq/hw-transport-web-ble@ledgerhq/hw-transport-webauthn@ledgerhq/hw-transport-webhid@ledgerhq/hw-transport-node-hid-noevents@ledgerhq/hw-transport-node-hid-singleton@ledgerhq/device-core@ledgerhq/devices@ledgerhq/domain-service@ledgerhq/hw-app-btc@ledgerhq/coin-evm@ledgerhq/coin-framework@ledgerhq/coin-near@ledgerhq/coin-polkadot@ledgerhq/coin-bitcoin@ledgerhq/react-native-hid@ledgerhq/react-native-hw-transport-ble@ledgerhq/vault-common@ledgerhq/wallet-btc@loon3/hw-app-btc@emurgo/react-native-hid@trustcrypto/devices@trustcrypto/hw-transport-node-hid@trustcrypto/hw-transport-node-hid-keyboard@trustcrypto/hw-transport-node-hid-noevents@fluent-wallet/hw-app-conflux@waves/ledger@aleworm/hw-transport-node-hid@aleworm/hw-transport-node-hid-noevents@shapeshiftoss/hdwallet-ledger-webusb@v-almonacid/react-native-hidaccumulate.js@wavesenterprise/west-ledger@backpacker69/hw-app-btc@backpacker69/hw-transport-webusb@claymore365123/hw-app-eth@blooo/hw-app-klaytn@codewarriorr/hw-app-btcv@codewarriorr/live-commoncceb
6.11.0

6 months ago

6.11.0-nightly.0

7 months ago

6.11.0-next.0

6 months ago

6.12.0-nightly.0

5 months ago

6.11.0-tag-word.0

6 months ago

6.12.0

5 months ago

6.12.0-next.0

6 months ago

6.10.1-next.0

2 years ago

6.10.1

2 years ago

6.10.1-nightly.1

2 years ago

6.10.1-nightly.0

2 years ago

6.9.1-taproot.0

3 years ago

6.10.0

3 years ago

6.2.0-bsc.5

3 years ago

6.2.0-bsc.4

3 years ago

6.2.0

3 years ago

6.2.0-bsc.1

3 years ago

6.2.0-bsc.2

3 years ago

6.2.0-bsc.3

3 years ago

6.2.0-bsc.0

3 years ago

6.0.1

3 years ago

6.0.0

3 years ago

6.0.2

3 years ago

6.0.0-rc.0

3 years ago

6.0.0-alpha.5

3 years ago

5.48.1-alpha.25

3 years ago

5.50.0

3 years ago

5.49.0

3 years ago

5.48.1-uglify.0

3 years ago

5.48.0

3 years ago

5.46.0

3 years ago

5.43.0

3 years ago

5.41.0

3 years ago

5.39.2

3 years ago

5.40.0

3 years ago

5.39.0

3 years ago

5.38.0

3 years ago

5.36.0

3 years ago

5.30.0

3 years ago

5.29.0

3 years ago

5.28.0

4 years ago

5.26.0

4 years ago

5.25.0

4 years ago

5.23.0

4 years ago

5.22.0

4 years ago

5.21.0

4 years ago

5.19.1

4 years ago

5.19.0

4 years ago

5.17.0

4 years ago

5.15.0

4 years ago

5.13.1

4 years ago

5.13.0

4 years ago

5.11.0

4 years ago

5.9.0

4 years ago

5.6.0

4 years ago

5.3.0

4 years ago

5.2.0

4 years ago

5.1.1-alpha.2

4 years ago

5.0.0

4 years ago

5.0.0-babel7.4

4 years ago

5.0.0-rc.4

4 years ago

5.0.0-babel7.3

4 years ago

5.0.0-babel7.1

4 years ago

5.0.0-alpha.7

4 years ago

4.74.3-alpha.6

4 years ago

5.0.0-alpha.5

4 years ago

5.0.0-alpha.4

4 years ago

5.0.0-alpha.3

4 years ago

5.0.0-alpha.1

4 years ago

4.72.0

5 years ago

4.70.0

5 years ago

4.69.3-alpha.1

5 years ago

4.68.2

5 years ago

4.64.0

5 years ago

4.62.0

5 years ago

4.61.0

5 years ago

4.60.3

5 years ago

4.60.2

5 years ago

4.60.0

5 years ago

4.59.1-alpha.2

5 years ago

4.58.0

5 years ago

4.56.0

5 years ago