@seek/logger
Advanced tools
Comparing version 8.0.0 to 8.1.0
@@ -29,10 +29,13 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.pino = exports.DEFAULT_OMIT_HEADER_NAMES = void 0; | ||
exports.pino = exports.DEFAULT_OMIT_HEADER_NAMES = exports.createDestination = void 0; | ||
const pino_1 = __importDefault(require("pino")); | ||
exports.pino = pino_1.default; | ||
const base_1 = __importDefault(require("./base")); | ||
const destination_1 = require("./destination"); | ||
const create_1 = require("./destination/create"); | ||
const redact_1 = require("./destination/redact"); | ||
const formatters_1 = require("./formatters"); | ||
const redact = __importStar(require("./redact")); | ||
const serializers_1 = require("./serializers"); | ||
var create_2 = require("./destination/create"); | ||
Object.defineProperty(exports, "createDestination", { enumerable: true, get: function () { return create_2.createDestination; } }); | ||
var serializers_2 = require("./serializers"); | ||
@@ -49,5 +52,4 @@ Object.defineProperty(exports, "DEFAULT_OMIT_HEADER_NAMES", { enumerable: true, get: function () { return serializers_2.DEFAULT_OMIT_HEADER_NAMES; } }); | ||
// istanbul ignore next | ||
destination = pino_1.default.destination({ | ||
sync: true, | ||
})) => { | ||
destination = (0, create_1.createDestination)({ mock: false }) | ||
.destination) => { | ||
opts.redact = redact.addDefaultRedactPathStrings(opts.redact); | ||
@@ -69,4 +71,4 @@ const serializers = (0, serializers_1.createSerializers)(opts); | ||
opts.timestamp ??= () => `,"timestamp":"${new Date().toISOString()}"`; | ||
return (0, pino_1.default)(opts, (0, destination_1.withRedaction)(destination, opts.redactText)); | ||
return (0, pino_1.default)(opts, (0, redact_1.withRedaction)(destination, opts.redactText)); | ||
}; | ||
//# sourceMappingURL=index.js.map |
import pino from 'pino'; | ||
import base from './base'; | ||
import { withRedaction } from './destination'; | ||
import { createDestination } from './destination/create'; | ||
import { withRedaction } from './destination/redact'; | ||
import { createFormatters } from './formatters'; | ||
import * as redact from './redact'; | ||
import { createSerializers } from './serializers'; | ||
export { createDestination } from './destination/create'; | ||
export { DEFAULT_OMIT_HEADER_NAMES } from './serializers'; | ||
@@ -18,5 +20,4 @@ export { pino }; | ||
// istanbul ignore next | ||
destination = pino.destination({ | ||
sync: true, | ||
})) => { | ||
destination = createDestination({ mock: false }) | ||
.destination) => { | ||
opts.redact = redact.addDefaultRedactPathStrings(opts.redact); | ||
@@ -23,0 +24,0 @@ const serializers = createSerializers(opts); |
@@ -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 & Pick<LoggerOptions, "serializers">) => LoggerOptions["formatters"]; |
import pino from 'pino'; | ||
import { type FormatterOptions } from './formatters'; | ||
import { type SerializerOptions } from './serializers'; | ||
export { createDestination } from './destination/create'; | ||
export { DEFAULT_OMIT_HEADER_NAMES } from './serializers'; | ||
@@ -5,0 +6,0 @@ export { pino }; |
@@ -12,5 +12,5 @@ export declare const defaultRedact: string[]; | ||
paths: string[]; | ||
censor?: string | ((value: unknown, path: string[]) => unknown) | undefined; | ||
remove?: boolean | undefined; | ||
censor?: string | ((value: unknown, path: string[]) => unknown); | ||
remove?: boolean; | ||
}; | ||
export {}; |
{ | ||
"name": "@seek/logger", | ||
"version": "8.0.0", | ||
"version": "8.1.0", | ||
"private": false, | ||
@@ -43,11 +43,13 @@ "description": "Standardized logging", | ||
"pino": "^9.0.0", | ||
"pino-std-serializers": "^6.2.0" | ||
"pino-std-serializers": "^7.0.0" | ||
}, | ||
"devDependencies": { | ||
"@changesets/cli": "2.27.1", | ||
"@changesets/cli": "2.27.5", | ||
"@changesets/get-github-info": "0.6.0", | ||
"@types/fast-redact": "3.0.4", | ||
"@types/split2": "4.2.3", | ||
"skuba": "8.0.1", | ||
"skuba": "8.1.0", | ||
"split2": "4.2.0" | ||
}, | ||
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e", | ||
"engines": { | ||
@@ -65,4 +67,4 @@ "node": ">=18.18", | ||
"type": "package", | ||
"version": "7.5.0" | ||
"version": "8.1.0" | ||
} | ||
} |
@@ -30,9 +30,17 @@ # @seek/logger | ||
```typescript | ||
import createLogger from '@seek/logger'; | ||
import createLogger, { createDestination } from '@seek/logger'; | ||
// Initialize the logger. By default, this will log to stdout. | ||
const logger = createLogger({ | ||
name: 'my-app', | ||
const { destination, stdoutMock } = createDestination({ | ||
mock: config.environment === 'test', | ||
}); | ||
// Initialize the logger. | ||
// This will log to stdout if `createDestination` is not mocked. | ||
const logger = createLogger( | ||
{ | ||
name: 'my-app', | ||
}, | ||
destination, | ||
); | ||
// Write an informational (`level` 30) log with a `msg`. | ||
@@ -46,2 +54,6 @@ logger.info('Something good happened'); | ||
childLogger.error({ err }, 'Something bad happened'); | ||
// Introspect mocked calls in your test environment. | ||
// See the Testing section for more information. | ||
stdoutMock.calls; | ||
``` | ||
@@ -209,2 +221,6 @@ | ||
### Testing | ||
See [docs/testing.md](docs/testing.md). | ||
[error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error | ||
@@ -211,0 +227,0 @@ [Omitting Headers]: #omitting-headers |
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
55330
58
816
230
6
- Removedpino-std-serializers@6.2.2(transitive)
Updatedpino-std-serializers@^7.0.0