Skip to content
New issue

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

[patch] Allow log prefixes to be properly disabled when using custom logger #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions lib/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,17 @@ module.exports = function(overrides) {
configuredPrefix = '';
}

// Default prefix for each log level to whatever's in the `prefixes conf,
// as long as no explicit global prefix was defined.
configuredPrefix = configuredPrefix || prefixes[logAt];
// Else default prefix for each log level to whatever's in the `prefixes conf`
// As long as a custom logger is not specified
else if (!options.custom) {
configuredPrefix = configuredPrefix || prefixes[logAt];
}

// Else if there is a custom logger and prefix is set to true
// Set the prefix for each log level to the defaults from `prefixes.conf`
else if (options.prefix === true) {
configuredPrefix = prefixes[logAt];
}

// Add some color
var colorizedPrefix = (function() {
Expand Down