Comparing version 4.0.1 to 4.0.2
@@ -22,3 +22,3 @@ // jscs:disable requireNamedUnassignedFunctions | ||
module( moduleName, stream ) { | ||
if( !moduleName ) { | ||
if( !moduleName && moduleName !== "" ) { | ||
const error = new Error().stack; | ||
@@ -52,3 +52,3 @@ const matches = error.match( /at (?:Context|Object).<anonymous> .*[\\/](.*?):/ ); | ||
LogFactory.isSilent = beSilent; | ||
this.isSilent = beSilent; | ||
this.__loggers.forEach( logger => { | ||
@@ -55,0 +55,0 @@ logger.enableLogging = !beSilent; |
{ | ||
"name": "fm-log", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "Console logging facility for Node", | ||
@@ -5,0 +5,0 @@ "main": "lib/log.js", |
@@ -60,2 +60,8 @@ "use strict"; | ||
} ); | ||
it( "should create an unprefixed logger", () => { | ||
log = require( "../lib/log.js" ).module( "" ).to( logStream ); | ||
log.debug( "!" ); | ||
result[ 0 ].should.match( /\d \[DEBUG ] !/ ); | ||
} ); | ||
} ); | ||
@@ -219,2 +225,17 @@ | ||
} ); | ||
describe( "silence", () => { | ||
it( "shouldn't log when silenced", () => { | ||
log = require( "../lib/log.js" ).module( "" ).to( logStream ).off(); | ||
log.info( "!" ); | ||
result.should.have.length( 0 ); | ||
} ); | ||
it( "shouldn't log when globally silenced", () => { | ||
require( "../lib/log.js" ).logFactory.silence(); | ||
log = require( "../lib/log.js" ).module( "" ).to( logStream ); | ||
log.info( "!" ); | ||
result.should.have.length( 0 ); | ||
} ); | ||
} ); | ||
} ); |
1169749
34520