@cumulus/logger
Advanced tools
Comparing version 1.24.0 to 2.0.0
@@ -1,2 +0,2 @@ | ||
/// <reference types="node" /> | ||
declare type Level = 'debug' | 'error' | 'fatal' | 'info' | 'trace' | 'warn'; | ||
declare type LoggerConstructorOptions = { | ||
@@ -24,2 +24,3 @@ asyncOperationId?: string; | ||
constructor(options?: LoggerConstructorOptions); | ||
buildMessage(level: Level, ...messageArgs: any[]): string; | ||
/** | ||
@@ -44,4 +45,4 @@ * Log a debug message | ||
* | ||
* @param additionalKeys - | ||
* @param messageArgs - the message to log | ||
* @param {Object} additionalKeys | ||
* @param {Array<any>} messageArgs - the message to log | ||
*/ | ||
@@ -57,4 +58,6 @@ infoWithAdditionalKeys(additionalKeys: object, ...messageArgs: any[]): void; | ||
warn(...messageArgs: any[]): void; | ||
private buildLogEventMessage; | ||
private writeLogEvent; | ||
} | ||
export = Logger; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -16,2 +16,5 @@ "use strict"; | ||
} | ||
buildMessage(level, ...messageArgs) { | ||
return this.buildLogEventMessage(level, messageArgs); | ||
} | ||
/** | ||
@@ -62,4 +65,4 @@ * Log a debug message | ||
* | ||
* @param additionalKeys - | ||
* @param messageArgs - the message to log | ||
* @param {Object} additionalKeys | ||
* @param {Array<any>} messageArgs - the message to log | ||
*/ | ||
@@ -81,3 +84,3 @@ infoWithAdditionalKeys(additionalKeys, ...messageArgs) { | ||
} | ||
writeLogEvent(level, messageArgs, additionalKeys = {}) { | ||
buildLogEventMessage(level, messageArgs, additionalKeys = {}) { | ||
let message; | ||
@@ -106,5 +109,8 @@ if (messageArgs.length === 0) { | ||
}; | ||
const logEventString = this.pretty | ||
? JSON.stringify(logEvent, null, 2) | ||
return this.pretty | ||
? JSON.stringify(logEvent, undefined, 2) | ||
: JSON.stringify(logEvent); | ||
} | ||
writeLogEvent(level, messageArgs, additionalKeys = {}) { | ||
const logEventString = this.buildLogEventMessage(level, messageArgs, additionalKeys); | ||
if (level === 'error') | ||
@@ -111,0 +117,0 @@ this.console.error(logEventString); |
{ | ||
"name": "@cumulus/logger", | ||
"version": "1.24.0", | ||
"version": "2.0.0", | ||
"description": "A log library for use on Cumulus", | ||
@@ -11,3 +11,3 @@ "keywords": [ | ||
"engines": { | ||
"node": ">=10.16.3" | ||
"node": ">=12.18.0" | ||
}, | ||
@@ -29,4 +29,6 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"clean": "rm -rf dist", | ||
"prepare": "npm run tsc", | ||
"test": "../../node_modules/.bin/ava", | ||
"test:coverage": "../../node_modules/.bin/nyc npm test", | ||
"tsc": "../../node_modules/.bin/tsc" | ||
@@ -37,7 +39,2 @@ }, | ||
}, | ||
"nyc": { | ||
"exclude": [ | ||
"test" | ||
] | ||
}, | ||
"author": "Cumulus Authors", | ||
@@ -48,3 +45,3 @@ "license": "Apache-2.0", | ||
}, | ||
"gitHead": "e98bd892450ac176e8e802a69d2c7d27a9ed3bca" | ||
"gitHead": "404fd959be4f17ccdf4f047f591ada7c2e39e3e9" | ||
} |
Sorry, the diff of this file is not supported yet
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
20474
177