We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I've seen talk of this throughout the Issues, but I don't see a solution. Is there a way to disable logging? I don't want to log when testing.
currently I'm disabling like this but it seems hacky
// logger.js const config = require('./config'); /* * LEVEL HIEARCHY * disable: > 60 * fatal :60 * error :50 -- logs everythig above * warn :40 -- logs everythig above * info :30 -- logs everythig above * debug :20 -- logs everythig above * trace :10 -- logs everythig above */ const LEVEL_DISABLE = 61; const DISABLE = config.LOG_DISABLE; module.exports = require('bunyan').createLogger({ name: config.SERVICE_NAME, streams: [{ level: DISABLE || config.LOG_STDOUT_DISABLE ? LEVEL_DISABLE : config.LOG_STDOUT_LEVEL, stream: process.stdout }, { level: DISABLE || config.LOG_FILE_DISABLE ? LEVEL_DISABLE : config.LOG_FILE_LEVEL, path: config.LOG_FILE }] });
// config.json { "LOG_FILE": "/var/tmp/node-bus-service.log", "LOG_FILE_LEVEL": "trace", "SERVICE_NAME": "node-bus-service", "development": { "LOG_DISABLE": true, "LOG_FILE_DISABLE": true, "LOG_STDOUT_DISABLE": false, "LOG_STDOUT_LEVEL": "info" }, "qa": {}, "test": {} }
The text was updated successfully, but these errors were encountered:
@CodisRedding Setting the level to higher than the 'fatal' level is what I'd do. However, I'd probably do something like this:
// ... if (config.LOG_DISABLE) { log.level(bunyan.FATAL + 1) }
Note that eventually I'd like to have an "off"/bunyan.OFF "level" to more explicitly turn logging off.
"off"/bunyan.OFF
Sorry, something went wrong.
No branches or pull requests
I've seen talk of this throughout the Issues, but I don't see a solution. Is there a way to disable logging? I don't want to log when testing.
currently I'm disabling like this but it seems hacky
The text was updated successfully, but these errors were encountered: