Skip to content

Conversation

@jjanczyszyn
Copy link

@jjanczyszyn jjanczyszyn commented Nov 22, 2018

Adds support for FASTLOG_GLOBAL_PREFIX environment variable

e.g.

process.env.FASTLOG_GLOBAL_PREFIX = '[ipAddress]';
var logger = require('fastlog')('configured', 'error', '${level} [${ category }] <${timestamp}>');
logger.error('You\'ve got a friend in me.');
// [ipAddress] error [configured] <Fri, 05 Dec 2014 02:10:48 GMT> You've got a friend in me.

why this might be useful:

Currently there's no way to ensure that all the logs in your application are using the same prefix.
For instance when you're including a dependency that's logging warnings (assuming that it's using fastlog for that). With the use of FASTLOG_GLOBAL_PREFIX it's easy.

For my use case, I'd like to include the EC2 ip address and be able to query logs for different instances later on.

@jjanczyszyn
Copy link
Author

not sure why Travis is failing.
I checked locally and when running node v0.10.48 (the version that travis is using) I get the same error on master.

the error:

/home/travis/build/willwhite/fastlog/node_modules/mocha/node_modules/debug/src/node.js:120
exports.inspectOpts = Object.keys(process.env).filter(key => {
                                                           ^
SyntaxError: Unexpected token >
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/travis/build/willwhite/fastlog/node_modules/mocha/node_modules/debug/src/index.js:9:19)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
npm ERR! Test failed.  See above for more details.
The command "npm test" exited with 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant