1.43.0 • Published 5 years ago

@listener-js/log v1.43.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

@listener-js/log

Listener logger

log

Install

npm install @listener-js/listener @listener-js/log

Enable logging

import { listener } from "@listener-js/listener"
import { log } from "@listener-js/log"

listener({ log })

Call logger directly

log.log([], "warn", "warning!")
// or
log.warn([], "warning!")

Log levels

There are six log levels: internal, trace, debug, info, warn, and error.

By default, the logger only logs messages at log level info or above. Change the log level through the LOG environment variable:

LOG=internal npm test

Or programmatically:

log.logLevel([], "internal")

Listener log level

You can also set log levels for specific listener functions:

log.logLevel([], "MyClass.myFn", "info")

Log strategies

There are three log strategies: args, argsJson, and ids (default).

Set the strategy via the LOG environment variable:

LOG=args npm test

To set the strategy and level, separate them with a colon (:):

LOG=trace:args npm test

Order does not matter when using the separator.

Log filtering

Pass a listener identifier to the LOG environment variable to filter:

LOG=MyClass.myFn npm test

Add a filter, strategy, and level all at once:

LOG=MyClass.myFn:args:internal npm test
1.43.0

5 years ago

1.42.0

5 years ago

1.41.0

5 years ago

1.40.0

5 years ago

1.39.0

5 years ago

1.38.0

5 years ago

1.37.0

5 years ago

1.36.0

5 years ago

1.35.0

5 years ago

1.34.0

5 years ago

1.33.0

5 years ago

1.32.0

5 years ago

1.31.0

5 years ago

1.30.0

5 years ago

1.29.0

5 years ago

1.28.0

5 years ago

1.27.0

5 years ago

1.26.0

5 years ago

1.25.0

5 years ago

1.24.0

5 years ago

1.23.0

5 years ago

1.22.4

5 years ago

1.22.3

5 years ago

1.22.2

5 years ago

1.22.1

5 years ago

1.22.0

5 years ago

1.21.0

5 years ago

1.20.1

5 years ago

1.20.0

5 years ago

1.19.2

5 years ago

1.19.1

5 years ago

1.19.0

5 years ago

1.18.0

5 years ago

1.17.0

5 years ago

1.16.0

5 years ago

1.15.0

5 years ago

1.14.0

5 years ago

1.13.0

5 years ago

1.12.0

5 years ago

1.11.0

5 years ago

1.10.0

5 years ago

1.9.0

5 years ago

1.8.0

5 years ago

1.7.0

5 years ago

1.6.0

5 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago