captains-log
Advanced tools
Comparing version 0.10.5 to 0.10.6
40
index.js
@@ -22,2 +22,19 @@ /** | ||
var DEFAULT_OPTIONS = { | ||
level: 'info', | ||
inspect: true, | ||
logLevels: { | ||
silly: 0, | ||
verbose: 1, | ||
info: 2, | ||
debug: 3, | ||
warn: 4, | ||
error: 5, | ||
// crit: 6, | ||
// emerg: 6, | ||
// fail: 6, | ||
silent: 7 | ||
} | ||
}; | ||
/** | ||
@@ -68,6 +85,3 @@ * | ||
options = _.cloneDeep(options); | ||
_.defaults(options, { | ||
level: 'debug', | ||
inspect: true | ||
}); | ||
_.defaults(options, DEFAULT_OPTIONS); | ||
@@ -127,20 +141,2 @@ | ||
// Default log levels | ||
options.logLevels = _.defaults(options.logLevels || {}, { | ||
silly: 0, | ||
verbose: 1, | ||
info: 2, | ||
// notice: 2, | ||
debug: 3, | ||
// alert: 4, | ||
warn: 4, | ||
// warning: 4, | ||
error: 5, | ||
// crit: 6, | ||
// emerg: 6, | ||
// fail: 6, | ||
silent: 7 | ||
}); | ||
@@ -147,0 +143,0 @@ var logger; |
{ | ||
"name": "captains-log", | ||
"version": "0.10.5", | ||
"version": "0.10.6", | ||
"description": "Simple wrapper around Winston to allow for declarative configuaration", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,7 +16,2 @@ var suites = require('./suites'); | ||
}); | ||
// Because the basic log usage defaults to `debug`, the log should write to stdout. | ||
describe('log()', function () { | ||
suites.console.countWritesToSpecificStreams(fixtures.log._call, | ||
{ stderr: 3, stdout: 0 }); | ||
}); | ||
describe('log.error()', function () { | ||
@@ -27,6 +22,13 @@ suites.console.countWritesToSpecificStreams(fixtures.log.error, | ||
// Because the direct usage of `log()` defaults to `debug`, | ||
// it should also write to stderr, just like `log.debug()` | ||
describe('log()', function () { | ||
suites.console.countWritesToSpecificStreams(fixtures.log._call, | ||
{ stderr: 3, stdout: 0 }); | ||
}); | ||
// Winston writes the rest of its logging methods to stdout | ||
describe('log.info()', function () { | ||
suites.console.countWritesToSpecificStreams(fixtures.log.info, | ||
{ stderr: 0, stdout: 0 }); | ||
{ stderr: 0, stdout: 3 }); | ||
}); | ||
@@ -33,0 +35,0 @@ describe('log.verbose()', function () { |
@@ -7,4 +7,4 @@ var suites = require('./suites'); | ||
describe('new CaptainsLog with configured', function () { | ||
describe('level (silent)', function () { | ||
@@ -11,0 +11,0 @@ before(function newLog() { |
@@ -56,3 +56,3 @@ /** | ||
describe('usage ::', function () { | ||
describe('::', function () { | ||
it('works with no arguments', logFn() ); | ||
@@ -62,3 +62,3 @@ it('works with one argument', logFn('a thing') ); | ||
}); | ||
describe('usage results ::', function () { | ||
describe('::', function () { | ||
it('should have written to stderr', expect.numWritesToStream({ | ||
@@ -65,0 +65,0 @@ streamId: 'stderr', |
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
25324
794