@seek/logger
Advanced tools
Comparing version 5.2.0 to 6.0.0
@@ -9,5 +9,4 @@ "use strict"; | ||
dest.write = (input) => { | ||
var _a; | ||
let redacted = input.replace(bearerMatcher, redactedDummy); | ||
redacted = (_a = redactText === null || redactText === void 0 ? void 0 : redactText(redacted, redactedDummy)) !== null && _a !== void 0 ? _a : redacted; | ||
redacted = redactText?.(redacted, redactedDummy) ?? redacted; | ||
return write(redacted); | ||
@@ -14,0 +13,0 @@ }; |
@@ -6,4 +6,3 @@ "use strict"; | ||
const createFormatters = (opts) => { | ||
var _a; | ||
const trim = (0, dtrim_1.trimmer)({ depth: (_a = opts.maxObjectDepth) !== null && _a !== void 0 ? _a : 4 }); | ||
const trim = (0, dtrim_1.trimmer)({ depth: opts.maxObjectDepth ?? 4 }); | ||
return { | ||
@@ -10,0 +9,0 @@ log: (input) => trim(input), |
@@ -40,3 +40,3 @@ "use strict"; | ||
* @param opts - Logger options. | ||
* @param destination - Destination stream. Default: `pino.destination(1)`. | ||
* @param destination - Destination stream. Default: `pino.destination({ sync: true })`. | ||
*/ | ||
@@ -47,4 +47,5 @@ exports.default = ( | ||
// istanbul ignore next | ||
destination = pino_1.default.destination(1)) => { | ||
var _a; | ||
destination = pino_1.default.destination({ | ||
sync: true, | ||
})) => { | ||
const formatters = (0, formatters_1.createFormatters)(opts); | ||
@@ -64,5 +65,5 @@ opts.redact = redact.addDefaultRedactPathStrings(opts.redact); | ||
}; | ||
(_a = opts.timestamp) !== null && _a !== void 0 ? _a : (opts.timestamp = () => `,"timestamp":"${new Date().toISOString()}"`); | ||
opts.timestamp ??= () => `,"timestamp":"${new Date().toISOString()}"`; | ||
return (0, pino_1.default)(opts, (0, destination_1.withRedaction)(destination, opts.redactText)); | ||
}; | ||
//# sourceMappingURL=index.js.map |
@@ -13,14 +13,11 @@ "use strict"; | ||
}; | ||
const req = (request) => { | ||
var _a, _b; | ||
return isObject(request) | ||
? { | ||
method: request.method, | ||
url: request.url, | ||
headers: request.headers, | ||
remoteAddress: (_a = request === null || request === void 0 ? void 0 : request.connection) === null || _a === void 0 ? void 0 : _a.remoteAddress, | ||
remotePort: (_b = request === null || request === void 0 ? void 0 : request.connection) === null || _b === void 0 ? void 0 : _b.remotePort, | ||
} | ||
: request; | ||
}; | ||
const req = (request) => isObject(request) | ||
? { | ||
method: request.method, | ||
url: request.url, | ||
headers: request.headers, | ||
remoteAddress: request?.socket?.remoteAddress, | ||
remotePort: request?.socket?.remotePort, | ||
} | ||
: request; | ||
const res = (response) => isObject(response) | ||
@@ -27,0 +24,0 @@ ? { |
@@ -6,5 +6,4 @@ const bearerMatcher = /\bbearer\s[\w._-]{25,}/gi; | ||
dest.write = (input) => { | ||
var _a; | ||
let redacted = input.replace(bearerMatcher, redactedDummy); | ||
redacted = (_a = redactText === null || redactText === void 0 ? void 0 : redactText(redacted, redactedDummy)) !== null && _a !== void 0 ? _a : redacted; | ||
redacted = redactText?.(redacted, redactedDummy) ?? redacted; | ||
return write(redacted); | ||
@@ -11,0 +10,0 @@ }; |
import { trimmer } from 'dtrim'; | ||
export const createFormatters = (opts) => { | ||
var _a; | ||
const trim = trimmer({ depth: (_a = opts.maxObjectDepth) !== null && _a !== void 0 ? _a : 4 }); | ||
const trim = trimmer({ depth: opts.maxObjectDepth ?? 4 }); | ||
return { | ||
@@ -6,0 +5,0 @@ log: (input) => trim(input), |
@@ -11,3 +11,3 @@ import pino from 'pino'; | ||
* @param opts - Logger options. | ||
* @param destination - Destination stream. Default: `pino.destination(1)`. | ||
* @param destination - Destination stream. Default: `pino.destination({ sync: true })`. | ||
*/ | ||
@@ -18,4 +18,5 @@ export default ( | ||
// istanbul ignore next | ||
destination = pino.destination(1)) => { | ||
var _a; | ||
destination = pino.destination({ | ||
sync: true, | ||
})) => { | ||
const formatters = createFormatters(opts); | ||
@@ -35,5 +36,5 @@ opts.redact = redact.addDefaultRedactPathStrings(opts.redact); | ||
}; | ||
(_a = opts.timestamp) !== null && _a !== void 0 ? _a : (opts.timestamp = () => `,"timestamp":"${new Date().toISOString()}"`); | ||
opts.timestamp ??= () => `,"timestamp":"${new Date().toISOString()}"`; | ||
return pino(opts, withRedaction(destination, opts.redactText)); | ||
}; | ||
//# sourceMappingURL=index.js.map |
@@ -8,14 +8,11 @@ import stdSerializers from 'pino-std-serializers'; | ||
}; | ||
const req = (request) => { | ||
var _a, _b; | ||
return isObject(request) | ||
? { | ||
method: request.method, | ||
url: request.url, | ||
headers: request.headers, | ||
remoteAddress: (_a = request === null || request === void 0 ? void 0 : request.connection) === null || _a === void 0 ? void 0 : _a.remoteAddress, | ||
remotePort: (_b = request === null || request === void 0 ? void 0 : request.connection) === null || _b === void 0 ? void 0 : _b.remotePort, | ||
} | ||
: request; | ||
}; | ||
const req = (request) => isObject(request) | ||
? { | ||
method: request.method, | ||
url: request.url, | ||
headers: request.headers, | ||
remoteAddress: request?.socket?.remoteAddress, | ||
remotePort: request?.socket?.remotePort, | ||
} | ||
: request; | ||
const res = (response) => isObject(response) | ||
@@ -22,0 +19,0 @@ ? { |
@@ -9,5 +9,5 @@ import pino from 'pino'; | ||
* @param opts - Logger options. | ||
* @param destination - Destination stream. Default: `pino.destination(1)`. | ||
* @param destination - Destination stream. Default: `pino.destination({ sync: true })`. | ||
*/ | ||
declare const _default: (opts?: LoggerOptions, destination?: pino.DestinationStream) => Logger; | ||
export default _default; |
/// <reference types="node" /> | ||
import stdSerializers from 'pino-std-serializers'; | ||
interface Connection { | ||
interface Socket { | ||
remoteAddress?: string; | ||
@@ -11,3 +11,3 @@ remotePort?: string; | ||
headers: Record<string, string>; | ||
connection: Connection; | ||
socket: Socket; | ||
} | ||
@@ -14,0 +14,0 @@ interface Response extends Record<string, unknown> { |
{ | ||
"name": "@seek/logger", | ||
"version": "5.2.0", | ||
"version": "6.0.0", | ||
"private": false, | ||
@@ -40,3 +40,3 @@ "description": "Standardized logging", | ||
"dtrim": "^1.9.0", | ||
"pino": "^7.10.0", | ||
"pino": "^8.0.0", | ||
"pino-std-serializers": "^6.0.0" | ||
@@ -46,7 +46,7 @@ }, | ||
"@types/split2": "3.2.1", | ||
"skuba": "5.1.1", | ||
"skuba": "6.0.2", | ||
"split2": "4.1.0" | ||
}, | ||
"engines": { | ||
"node": ">=12", | ||
"node": ">=16.11", | ||
"npm": ">=5.5.0" | ||
@@ -61,4 +61,4 @@ }, | ||
"type": "package", | ||
"version": "3.9.2" | ||
"version": "6.0.2" | ||
} | ||
} |
@@ -5,3 +5,3 @@ # @seek/logger | ||
[![GitHub Validate](https://github.com/seek-oss/logger/workflows/Validate/badge.svg?branch=master)](https://github.com/seek-oss/logger/actions?query=workflow%3AValidate) | ||
[![Node.js version](https://img.shields.io/badge/node-%3E%3D%208-brightgreen)](https://nodejs.org/en/) | ||
[![Node.js version](https://img.shields.io/badge/node-%3E%3D%2016.11-brightgreen)](https://nodejs.org/en/) | ||
[![npm package](https://img.shields.io/npm/v/@seek/logger)](https://www.npmjs.com/package/@seek/logger) | ||
@@ -8,0 +8,0 @@ [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) |
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
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
26468
320
+ Addedabort-controller@3.0.0(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbuffer@6.0.3(transitive)
+ Addedevent-target-shim@5.0.1(transitive)
+ Addedevents@3.3.0(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedon-exit-leak-free@2.1.2(transitive)
+ Addedpino@8.21.0(transitive)
+ Addedpino-abstract-transport@1.2.0(transitive)
+ Addedprocess@0.11.10(transitive)
+ Addedprocess-warning@3.0.0(transitive)
+ Addedreadable-stream@4.6.0(transitive)
+ Addedreal-require@0.2.0(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsonic-boom@3.8.1(transitive)
+ Addedsplit2@4.2.0(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedthread-stream@2.7.0(transitive)
- Removedon-exit-leak-free@0.2.0(transitive)
- Removedpino@7.11.0(transitive)
- Removedpino-std-serializers@4.0.0(transitive)
- Removedprocess-warning@1.0.0(transitive)
- Removedreal-require@0.1.0(transitive)
- Removedsonic-boom@2.8.0(transitive)
- Removedthread-stream@0.15.2(transitive)
Updatedpino@^8.0.0