captains-log
Advanced tools
Comparing version 0.11.0 to 0.11.1
@@ -65,6 +65,24 @@ /** | ||
require('colors').setTheme(options.colors); | ||
options.prefixes = {}; | ||
options.prefixes = {}; | ||
// Use prefixTheme if specified | ||
var theme = (options.prefixTheme || DEFAULT.OPTIONS.prefixTheme); | ||
var prefixes = DEFAULT.OPTIONS.prefixes; | ||
if (theme) { | ||
prefixes = (options.prefixThemes || DEFAULT.OPTIONS.prefixThemes)[theme]; | ||
} | ||
DEFAULT.METHODS.forEach(function (logAt) { | ||
options.prefixes[logAt] = DEFAULT.OPTIONS.prefixes[logAt][logAt]; | ||
var prefix = prefixes[logAt]; | ||
// If a `prefix` was specified, use it instead | ||
// (keep in mind this is only if the user didn't define `prefixes`) | ||
var configuredPrefix = (options.prefix || DEFAULT.OPTIONS.prefix); | ||
if (configuredPrefix) { | ||
prefix = configuredPrefix; | ||
} | ||
// Add some color | ||
var colorizedPrefix = prefix[logAt]; | ||
options.prefixes[logAt] = colorizedPrefix; | ||
}); | ||
@@ -77,2 +95,5 @@ } | ||
return options; | ||
@@ -79,0 +100,0 @@ }; |
@@ -29,12 +29,50 @@ /** | ||
prefixes: { | ||
silly : '| silly | ', | ||
verbose : '| verbose | ', | ||
info : '| info | ', | ||
debug : '| debug | ', | ||
warn : '| warning | ', | ||
error : '| error | ', | ||
crit : '| critical| ' | ||
} | ||
// If defined, uses a prefixTheme as default | ||
prefixTheme: 'moderate', | ||
// Different built-in prefix themes: | ||
prefixThemes: { | ||
traditional: { | ||
silly : 'silly: ', | ||
verbose : 'verbose: ', | ||
info : 'info: ', | ||
debug : 'debug: ', | ||
warn : 'warn: ', | ||
error : 'error: ', | ||
crit : 'CRITICAL: ' | ||
}, | ||
abbreviated: { | ||
silly : '[~] ', | ||
verbose : '[v] ', | ||
info : '[i] ', | ||
debug : '[d] ', | ||
warn : '[!] ', | ||
error : '[!] ', | ||
crit : '[CRITICAL] ' | ||
}, | ||
moderate: { | ||
silly : '[silly] ', | ||
verbose : '[verbose] ', | ||
info : ' ', | ||
debug : '[-] ', | ||
warn : '[!] ', | ||
error : '[err] ', | ||
crit : '[CRITICAL] ' | ||
}, | ||
aligned: { | ||
silly : 'silly | ', | ||
verbose : 'verbose | ', | ||
info : 'info | ', | ||
debug : 'debug | ', | ||
warn : 'warning | ', | ||
error : 'error | ', | ||
crit : 'CRITICAL| ' | ||
} | ||
}, | ||
// (if specified in defaults, overrides the prefixes above) | ||
// prefix: '||| ' | ||
}, | ||
@@ -41,0 +79,0 @@ |
{ | ||
"name": "captains-log", | ||
"version": "0.11.0", | ||
"version": "0.11.1", | ||
"description": "Simple wrapper around Winston to allow for declarative configuaration", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26922
782