TomFrost / Bristol

Insanely configurable logging for Node.js
MIT License
113 stars 19 forks source link

Origin logging not correct #21

Closed ghost closed 7 years ago

ghost commented 8 years ago

The origin logging always outputs the same file and line making it effectively useless. Every logged line shows the origin as coming from Bristol.js.

My application is running Node 6.6.0 with ES6 features.

2016-09-22 11:35:25 message="up and running!" severity="info" file="/.../node_modules/bristol/lib/Bristol.js" line="140"

TomFrost commented 7 years ago

Hey @robwalkerexp, sorry for the late response on this. I've been unable to reproduce this issue. See my test script below:

const log = require('bristol')

log.addTarget('console')
  .withFormatter('human')

log.info('test')

Output on node 6 and node 7:

[2016-12-16 17:02:39] INFO: test (/Users/tom/Projects/test/index.js:6)

Is there anything I'm missing to reproduce? I'm prepping a v2 release and would love to patch this before then if there's a bug hiding in the origin-finding code.

ghost commented 7 years ago

Thanks for getting back to me. I just realized this only repros when node is set to strict mode so run the file with the --use_strict flag.

TomFrost commented 7 years ago

Got it! Thank you!

TomFrost commented 7 years ago

Confirmed fixed in https://github.com/TomFrost/Bristol/commit/7b42a762ca5103559778c86eb827eff0d873d1d4 -- will be released next week!