@contember/logger
Advanced tools
Comparing version 1.2.1 to 1.3.0-alpha.2
@@ -40,2 +40,5 @@ "use strict"; | ||
} | ||
else if (this.buffer.length === 0 && logEntryLevel >= this.options.logAlwaysLevel.value) { | ||
this.inner.handle(logEntry); | ||
} | ||
else { | ||
@@ -42,0 +45,0 @@ this.buffer.push(logEntry); |
@@ -54,10 +54,12 @@ "use strict"; | ||
log(level, errorOrMessage, { error: errorAttr, message: messageAttr, ...attributes } = {}) { | ||
var _a; | ||
const error = typeof errorOrMessage !== 'string' ? errorOrMessage : errorAttr; | ||
const message = typeof errorOrMessage === 'string' | ||
const errorMessage = typeof error === 'object' && error !== null && typeof error.message === 'string' | ||
? error.message : undefined; | ||
const passedMessage = typeof errorOrMessage === 'string' | ||
? errorOrMessage | ||
: (typeof messageAttr === 'string') | ||
? messageAttr | ||
: typeof error === 'object' && error !== null && typeof error.message === 'string' | ||
? error.message | ||
: 'unknown error'; | ||
: undefined; | ||
const message = errorMessage && passedMessage ? `${passedMessage}: ${errorMessage}` : ((_a = passedMessage !== null && passedMessage !== void 0 ? passedMessage : errorMessage) !== null && _a !== void 0 ? _a : 'undefined message'); | ||
const now = new Date(); | ||
@@ -64,0 +66,0 @@ let formatted; |
@@ -10,2 +10,3 @@ export { createLogger } from './impl'; | ||
export * from './handlers/NullLoggerHandler'; | ||
export * from './handlers/TestLoggerHandler'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -28,2 +28,3 @@ "use strict"; | ||
__exportStar(require("./handlers/NullLoggerHandler"), exports); | ||
__exportStar(require("./handlers/TestLoggerHandler"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@contember/logger", | ||
"version": "1.2.1", | ||
"version": "1.3.0-alpha.2", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
@@ -56,2 +56,5 @@ import { LogEntry, LoggerHandler, LoggerHandlerFactory, LogLevel } from '../types' | ||
} else if (this.buffer.length === 0 && logEntryLevel >= this.options.logAlwaysLevel.value) { | ||
this.inner.handle(logEntry) | ||
} else { | ||
@@ -58,0 +61,0 @@ this.buffer.push(logEntry) |
@@ -87,10 +87,13 @@ import { | ||
const error: unknown | undefined = typeof errorOrMessage !== 'string' ? errorOrMessage : errorAttr | ||
const message: string = typeof errorOrMessage === 'string' | ||
const errorMessage = typeof error === 'object' && error !== null && typeof (error as any).message === 'string' | ||
? (error as any).message : undefined | ||
const passedMessage = typeof errorOrMessage === 'string' | ||
? errorOrMessage | ||
: (typeof messageAttr === 'string') | ||
? messageAttr | ||
: typeof error === 'object' && error !== null && typeof (error as any).message === 'string' | ||
? (error as any).message | ||
: 'unknown error' | ||
: undefined | ||
const message = errorMessage && passedMessage ? `${passedMessage}: ${errorMessage}` : (passedMessage ?? errorMessage ?? 'undefined message') | ||
const now = new Date() | ||
@@ -97,0 +100,0 @@ let formatted: LogEntryFormatted |
@@ -10,1 +10,2 @@ export { createLogger } from './impl' | ||
export * from './handlers/NullLoggerHandler' | ||
export * from './handlers/TestLoggerHandler' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
101453
66
1249
3