Releases: jclem/logfmt2
Releases · jclem/logfmt2
v2.4.3
What's Changed
- Bump mixin-deep from 1.3.1 to 1.3.2 by @dependabot in #5
- Bump js-yaml from 3.12.0 to 3.14.0 by @dependabot in #4
- Bump acorn from 5.7.3 to 5.7.4 by @dependabot in #3
- Bump lodash from 4.17.11 to 4.17.15 by @dependabot in #2
- Bump handlebars from 4.0.12 to 4.5.3 by @dependabot in #1
- Bump lodash from 4.17.15 to 4.17.19 by @dependabot in #6
New Contributors
- @dependabot made their first contribution in #5
Full Changelog: 2.4.2...v2.4.3
v2.4.2
logfmt2
logfmt2 (which is based on the original logfmt and the original blog post is a module for encoding objects into the logfmt format and decoding them again.
Install
npm install @jclem/logfmt2
Build
script/build
Publish
The script/publish
script cleans the build directory, builds the project, and then runs npm publish
.
script/publish
Usage
const {Logger, encode, decode} = require('@jclem/logfmt2')
console.log(encode({foo: 'bar'})) // foo=bar
console.log(decode('foo=bar')) // {foo: 'bar'}
// Use the static `Logger.log` to stdout
Logger.log({foo: 'bar'}) // logs "foo=bar"
// Create a logger to maintain a logging context
const logger = new Logger({ns: 'my-app'})
logger.log({foo: 'bar'}) // logs "ns=my-app foo=bar"
// Add timers
logger.time('elapsedMs')
// Wait 50ms
logger.log({foo: 'bar'}) // logs "ns=my-app elapsedMs=50 foo=bar"
// Wait 50ms
logger.log({foo: 'bar'}) // logs "ns=my-app elapsedMs=100 foo=bar"
// Add (mutate) the logger context
logger.appendContext({new_context: 'hello'})
logger.log({foo: 'bar'}) // logs "ns=my-app new_context=hello elapsedMs=100 foo=bar"
2.4.2
v2.4.1
logfmt2
logfmt2 (which is based on the original logfmt and the original blog post is a module for encoding objects into the logfmt format and decoding them again.
Install
npm install @jclem/logfmt2
Build
script/build
Publish
The script/publish
script cleans the build directory, builds the project, and then runs npm publish
.
script/publish
Usage
const {Logger, encode, decode} = require('@jclem/logfmt2')
console.log(encode({foo: 'bar'})) // foo=bar
console.log(decode('foo=bar')) // {foo: 'bar'}
// Use the static `Logger.log` to stdout
Logger.log({foo: 'bar'}) // logs "foo=bar"
// Create a logger to maintain a logging context
const logger = new Logger({ns: 'my-app'})
logger.log({foo: 'bar'}) // logs "ns=my-app foo=bar"
// Add timers
logger.time('elapsedMs')
// Wait 50ms
logger.log({foo: 'bar'}) // logs "ns=my-app elapsedMs=50 foo=bar"
// Wait 50ms
logger.log({foo: 'bar'}) // logs "ns=my-app elapsedMs=100 foo=bar"
// Add (mutate) the logger context
logger.appendContext({new_context: 'hello'})
logger.log({foo: 'bar'}) // logs "ns=my-app new_context=hello elapsedMs=100 foo=bar"