@cliengo/logger
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -98,2 +98,20 @@ "use strict"; | ||
} | ||
/** logs a handled client error | ||
* @param {string} [entry.context] name of class+method or function where the log is called (optional) | ||
* @param {string} [entry.message] string description of the logged action (optional) | ||
* @param {unknown} [entry.metadata] object for giving further information (optional) | ||
* @param {ErrorCode} entry.errorCode standard code of the error | ||
*/ | ||
clientError(entry) { | ||
const { context, message, metadata, errorCode } = entry; | ||
this.logger.log({ | ||
level: enum_1.Level.warn, | ||
message: message || ErrorCodeDefaultDesciption[errorCode], | ||
category: enum_1.Category.EXCEPTION, | ||
context, | ||
correlationId: express_correlation_id_1.default.getId(), | ||
errorCode, | ||
metadata, | ||
}); | ||
} | ||
/** logs an operation, like database access | ||
@@ -100,0 +118,0 @@ * @param {string} [entry.context] name of class+method or function where the log is called (optional) |
@@ -31,2 +31,9 @@ import correlator from "express-correlation-id"; | ||
exception(entry: ILogErrorEntry): void; | ||
/** logs a handled client error | ||
* @param {string} [entry.context] name of class+method or function where the log is called (optional) | ||
* @param {string} [entry.message] string description of the logged action (optional) | ||
* @param {unknown} [entry.metadata] object for giving further information (optional) | ||
* @param {ErrorCode} entry.errorCode standard code of the error | ||
*/ | ||
clientError(entry: ILogErrorEntry): void; | ||
/** logs an operation, like database access | ||
@@ -33,0 +40,0 @@ * @param {string} [entry.context] name of class+method or function where the log is called (optional) |
@@ -92,2 +92,20 @@ import correlator from "express-correlation-id"; | ||
} | ||
/** logs a handled client error | ||
* @param {string} [entry.context] name of class+method or function where the log is called (optional) | ||
* @param {string} [entry.message] string description of the logged action (optional) | ||
* @param {unknown} [entry.metadata] object for giving further information (optional) | ||
* @param {ErrorCode} entry.errorCode standard code of the error | ||
*/ | ||
clientError(entry) { | ||
const { context, message, metadata, errorCode } = entry; | ||
this.logger.log({ | ||
level: Level.warn, | ||
message: message || ErrorCodeDefaultDesciption[errorCode], | ||
category: Category.EXCEPTION, | ||
context, | ||
correlationId: correlator.getId(), | ||
errorCode, | ||
metadata, | ||
}); | ||
} | ||
/** logs an operation, like database access | ||
@@ -94,0 +112,0 @@ * @param {string} [entry.context] name of class+method or function where the log is called (optional) |
@@ -31,2 +31,9 @@ import correlator from "express-correlation-id"; | ||
exception(entry: ILogErrorEntry): void; | ||
/** logs a handled client error | ||
* @param {string} [entry.context] name of class+method or function where the log is called (optional) | ||
* @param {string} [entry.message] string description of the logged action (optional) | ||
* @param {unknown} [entry.metadata] object for giving further information (optional) | ||
* @param {ErrorCode} entry.errorCode standard code of the error | ||
*/ | ||
clientError(entry: ILogErrorEntry): void; | ||
/** logs an operation, like database access | ||
@@ -33,0 +40,0 @@ * @param {string} [entry.context] name of class+method or function where the log is called (optional) |
{ | ||
"name": "@cliengo/logger", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "...", | ||
@@ -5,0 +5,0 @@ "exports": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
50828
790