Releases: telefonicaid/logops
Releases · telefonicaid/logops
2.1.2
What's Changed
- Bump acorn from 6.2.1 to 6.4.1 by @dependabot in #49
- Bump diff from 3.2.0 to 3.5.0 by @dependabot in #47
- Switch from colors to chalk by @jason-fox in #63
New Contributors
- @dependabot made their first contribution in #49
- @jason-fox made their first contribution in #63
Full Changelog: 2.1.1...2.1.2
Release 2.1.0
Feature: Child Loggers
You can create an specialized logger for a part of your app with bound static context/properties. The child logger will inherit its parent config: level, format, stream and context. If the parent logger has a context returned by parent.getContext(), the conflicting child logger context will take precedence
let child = logger.child({component: 'client'});
child.info('Startup');
// {"component":"client","time":"2015-12-23T11:47:25.862Z","lvl":"INFO","msg":"Startup"}
https://github.com/telefonicaid/logops#child-loggers
Performance improvements
2.0.0
Sets the node environment for this version to be node>6
Feature:
- Make node 6 compatible (#39)
BREAKING CHANGES:
- Dates are formatted always as ISOString when used as parameter without placeholders
logger.info('Today is', new Date());
// Before: "msg": "Today is Thu Jan 01 1970 01:00:00 GMT+0100 (CET)"
// Now: "msg": "Today is 1970-01-01T00:00:00.000Z"
- Errors will incorporate stack traces instead of the node4 bracket notation when used as parameter without placeholders
logger.info('Oh oh!', new Error('boom'))
// Before: "msg": "Oh oh! [Error: boom]"
// Now: "msg": "Oh oh! Error: boom\n at repl:1:23\n at sigintHandlersWrap (vm.js:22:35)\n at sigintHandlersWrap (vm.js:96:12)\n at ContextifyScript.Script.runInThisContext (vm.js:21:12)\n at REPLServer.defaultEval (repl.js:340:29)\n at bound (domain.js:280:14)\n at REPLServer.runBound [as eval] (domain.js:293:12)\n at REPLServer.<anonymous> (repl.js:538:10)\n at emitOne (events.js:101:20)\n at REPLServer.emit (events.js:188:7)"
When used with placeholders the behavior is consistent across versions
// Both in 1.x and 2.x, the output is the same
logger.info('Today is %s', new Date())
// "msg":"Today is Thu Jan 01 1970 01:00:00 GMT+0100 (CET)"
logger.info('Oh oh! %s', new Error('boom'))
// "msg":"Oh oh! Error: boom"
Inherited breaking changes explanation
Node6 incorporated these breaking changes that we inherit because we delegate in utils.format
(ref https://github.com/nodejs/node/wiki/Breaking-changes-between-v5-and-v6#util)
- util: Change how Error objects are formatted
- util,test: Use consistent Date representation for util/inspect
##### node 6
> console.log('Today is', new Date())
Today is 2017-05-04T07:37:31.343Z
> console.log('Today is %s', new Date())
Today is Thu May 04 2017 09:37:37 GMT+0200 (CEST)
> console.log('Oh oh!', new Error('boom'))
Oh oh! Error: boom
at repl:1:23
at sigintHandlersWrap (vm.js:22:35)
at sigintHandlersWrap (vm.js:96:12)
at ContextifyScript.Script.runInThisContext (vm.js:21:12)
at REPLServer.defaultEval (repl.js:340:29)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.<anonymous> (repl.js:538:10)
at emitOne (events.js:101:20)
at REPLServer.emit (events.js:188:7)
> console.log('Oh oh! %s', new Error('boom'))
Oh oh! Error: boom
##### node 4
> console.log('Today is', new Date())
Today is Thu May 04 2017 09:40:22 GMT+0200 (CEST)
> console.log('Today is %s', new Date())
Today is Thu May 04 2017 09:40:25 GMT+0200 (CEST)
> console.log('Oh oh!', new Error('boom'))
Oh oh! [Error: boom]
> console.log('Oh oh! %s', new Error('boom'))
Oh oh! Error: boom
1.0.8
Release 1.0.7
Release 1.0.7
Release 1.0.6
Release 1.0.6
Release 1.0.5
Release 1.0.5
Release 1.0.4
Release 1.0.4
Release 1.0.3
Release 1.0.3
Release 1.0.2
Release 1.0.2