2.1.1 • Published 2 years ago

logslot v2.1.1

Weekly downloads
142
License
MIT
Repository
github
Last release
2 years ago

logslot

GitHub code size in bytes GitHub package.json version GitHub

A tiny logger that outputs json at runtime and pretty logs during development

Example Usage

const logslot = require('logslot');
logslot('myapp.test.one').error('some error', { extraThings: 1 })
logslot('myapp.test.one').warn('a warning', { extraThings: 2 })
logslot('myapp.test.one').info('for your info', { extraThings: 3 })
logslot('myapp.test.one').verbose('lots of detail', { extraThings: 4 })
logslot('myapp.test.one').debug('for the devs', { a: 1, b: 2 })
logslot('myapp.test.two').info('different namespace', { extraThings: 10 })

Output (json)

["23/02/2021 10:57:37 pm","myapp:test:one","ERROR","some error"]
["23/02/2021 10:57:37 pm","myapp:test:one","WARN","a warning"]
["23/02/2021 10:57:37 pm","myapp:test:one","INFO","for your info"]
["23/02/2021 10:57:37 pm","myapp:test:two","VERBOSE","lots of detail"]
["23/02/2021 10:57:37 pm","myapp:test:two","DEBUG","for the devs",{"a":1,"b":2}]
["23/02/2021 10:57:37 pm","myapp:test:two","INFO","different namespace",{"extraThings":10}]

Log level

You can set the log level from an environment variable:

LOGSLOT_LEVEL=debug

Or with code:

const logslot = require('logslot');
logslot.setLogLevel('debug');

Output (pretty)

LOGSLOT_FORMAT=pretty

screenshot

License

This project is licensed under the terms of the MIT license.

2.1.1

2 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.1.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.0

3 years ago