json-logger-service
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -44,3 +44,3 @@ "use strict"; | ||
it('Should log error', () => { | ||
jsonLoggerService.error({ a: 'CONTEXT' }, 'TRACE', 'It works!'); | ||
jsonLoggerService.error('It works!', 'TRACE', 'CONTEXT'); | ||
}); | ||
@@ -76,2 +76,8 @@ it('Should log debug', () => { | ||
}); | ||
it('Should log error with context without throwing errors', () => { | ||
logger.error({ context: 'Hello World' }, 'It works!'); | ||
}); | ||
it('Should log error with context and trace without throwing errors', () => { | ||
logger.error({ context: 'Hello World' }, 'TRACE', 'It works!'); | ||
}); | ||
it('Should log warn without throwing errors', () => { | ||
@@ -78,0 +84,0 @@ logger.warn('It works!'); |
@@ -14,4 +14,14 @@ "use strict"; | ||
error(context, trace, message) { | ||
const bunyanParams = this.getBunyanParams(message, context); | ||
this.bunyanLogger.error(bunyanParams.context, trace, bunyanParams.message); | ||
if (trace && message) { | ||
const bunyanParams = this.getBunyanParams(message, context); | ||
this.bunyanLogger.error(bunyanParams.context, trace, bunyanParams.message); | ||
} | ||
else if (trace) { | ||
const bunyanParams = this.getBunyanParams(trace, context); | ||
this.bunyanLogger.error(bunyanParams.context, bunyanParams.message); | ||
} | ||
else { | ||
const bunyanParams = this.getBunyanParams(undefined, context); | ||
this.bunyanLogger.error(bunyanParams.context, bunyanParams.message); | ||
} | ||
} | ||
@@ -18,0 +28,0 @@ warn(context, message) { |
{ | ||
"name": "json-logger-service", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "Nest Json LoggerService implementation.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
20964
244