@seek/logger
Advanced tools
Comparing version 8.1.0 to 8.1.1
@@ -8,2 +8,3 @@ "use strict"; | ||
const fast_redact_1 = __importDefault(require("fast-redact")); | ||
const isCall = (value) => value !== null && typeof value === 'object' && !Array.isArray(value); | ||
exports.DEFAULT_MOCK_OPTIONS = Object.freeze({ | ||
@@ -82,3 +83,3 @@ redact: [ | ||
call = JSON.parse(String(result)); | ||
if (call === null || typeof call !== 'object' || Array.isArray(call)) { | ||
if (!isCall(call)) { | ||
throw new Error(`@seek/logger mocking failed to process a log message: ${msg}`); | ||
@@ -85,0 +86,0 @@ } |
@@ -8,3 +8,3 @@ "use strict"; | ||
depth: opts.maxObjectDepth ?? 4, | ||
retain: new Set(Object.keys(opts.serializers ?? {})), | ||
retain: new Set(Object.keys(opts.serializers)), | ||
}); | ||
@@ -11,0 +11,0 @@ return { |
@@ -47,15 +47,11 @@ "use strict"; | ||
*/ | ||
exports.default = ( | ||
// istanbul ignore next | ||
opts = {}, | ||
// istanbul ignore next | ||
destination = (0, create_1.createDestination)({ mock: false }) | ||
exports.default = (opts = {}, destination = (0, create_1.createDestination)({ mock: false }) | ||
.destination) => { | ||
opts.redact = redact.addDefaultRedactPathStrings(opts.redact); | ||
const serializers = (0, serializers_1.createSerializers)(opts); | ||
opts.serializers = { | ||
...serializers, | ||
const serializers = { | ||
...(0, serializers_1.createSerializers)(opts), | ||
...opts.serializers, | ||
}; | ||
const formatters = (0, formatters_1.createFormatters)(opts); | ||
opts.serializers = serializers; | ||
const formatters = (0, formatters_1.createFormatters)({ ...opts, serializers }); | ||
opts.base = { | ||
@@ -62,0 +58,0 @@ ...base_1.default, |
import fastRedact from 'fast-redact'; | ||
const isCall = (value) => value !== null && typeof value === 'object' && !Array.isArray(value); | ||
export const DEFAULT_MOCK_OPTIONS = Object.freeze({ | ||
@@ -75,3 +76,3 @@ redact: [ | ||
call = JSON.parse(String(result)); | ||
if (call === null || typeof call !== 'object' || Array.isArray(call)) { | ||
if (!isCall(call)) { | ||
throw new Error(`@seek/logger mocking failed to process a log message: ${msg}`); | ||
@@ -78,0 +79,0 @@ } |
@@ -5,3 +5,3 @@ import { trimmer } from 'dtrim'; | ||
depth: opts.maxObjectDepth ?? 4, | ||
retain: new Set(Object.keys(opts.serializers ?? {})), | ||
retain: new Set(Object.keys(opts.serializers)), | ||
}); | ||
@@ -8,0 +8,0 @@ return { |
@@ -16,15 +16,11 @@ import pino from 'pino'; | ||
*/ | ||
export default ( | ||
// istanbul ignore next | ||
opts = {}, | ||
// istanbul ignore next | ||
destination = createDestination({ mock: false }) | ||
export default (opts = {}, destination = createDestination({ mock: false }) | ||
.destination) => { | ||
opts.redact = redact.addDefaultRedactPathStrings(opts.redact); | ||
const serializers = createSerializers(opts); | ||
opts.serializers = { | ||
...serializers, | ||
const serializers = { | ||
...createSerializers(opts), | ||
...opts.serializers, | ||
}; | ||
const formatters = createFormatters(opts); | ||
opts.serializers = serializers; | ||
const formatters = createFormatters({ ...opts, serializers }); | ||
opts.base = { | ||
@@ -31,0 +27,0 @@ ...base, |
@@ -27,11 +27,11 @@ import { type MockOptions } from './mock'; | ||
destination: import("sonic-boom").default | { | ||
calls: object[]; | ||
calls: Readonly<Record<PropertyKey, unknown>>[]; | ||
clear: () => void; | ||
onlyCall: () => object; | ||
onlyCall: () => Readonly<Record<PropertyKey, unknown>>; | ||
write: (msg: string) => void; | ||
}; | ||
stdoutMock: { | ||
calls: object[]; | ||
calls: Readonly<Record<PropertyKey, unknown>>[]; | ||
clear: () => void; | ||
onlyCall: () => object; | ||
onlyCall: () => Readonly<Record<PropertyKey, unknown>>; | ||
write: (msg: string) => void; | ||
@@ -38,0 +38,0 @@ }; |
@@ -0,1 +1,2 @@ | ||
type Call = Readonly<Record<PropertyKey, unknown>>; | ||
export type MockOptions = { | ||
@@ -35,3 +36,3 @@ /** | ||
*/ | ||
calls: object[]; | ||
calls: Readonly<Record<PropertyKey, unknown>>[]; | ||
/** | ||
@@ -58,3 +59,3 @@ * Convenience method to clear the logging calls recorded to date. | ||
*/ | ||
onlyCall: () => object; | ||
onlyCall: () => Call; | ||
/** | ||
@@ -65,1 +66,2 @@ * Underlying method that `@seek/logger` calls to persist logs. | ||
}; | ||
export {}; |
@@ -12,2 +12,2 @@ import type { LoggerOptions } from 'pino'; | ||
} | ||
export declare const createFormatters: (opts: FormatterOptions & Pick<LoggerOptions, "serializers">) => LoggerOptions["formatters"]; | ||
export declare const createFormatters: (opts: FormatterOptions & Required<Pick<LoggerOptions, "serializers">>) => LoggerOptions["formatters"]; |
{ | ||
"name": "@seek/logger", | ||
"version": "8.1.0", | ||
"version": "8.1.1", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "Standardized logging", |
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
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
55725
812