@decohere/scribe-pino 0.0.1-dev.126 → 0.0.1-dev.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commonjs/src/index.js +2 -1
- package/commonjs/src/pino.adapater.js +7 -130
- package/commonjs/src/scribe-pino.js +31 -132
- package/es6/src/index.js +2 -1
- package/es6/src/pino.adapater.js +8 -131
- package/es6/src/scribe-pino.js +28 -114
- package/package.json +4 -25
- package/types/src/index.d.ts +0 -1
- package/types/src/pino.adapater.d.ts +0 -8
- package/types/src/scribe-pino.d.ts +8 -56
- package/LICENSE +0 -15
- package/commonjs/src/pino.recipe.js +0 -106
- package/commonjs/src/pino.transport-guard.js +0 -68
- package/es6/src/pino.recipe.js +0 -96
- package/es6/src/pino.transport-guard.js +0 -61
- package/types/src/pino.recipe.d.ts +0 -45
- package/types/src/pino.transport-guard.d.ts +0 -10
package/es6/src/scribe-pino.js
CHANGED
|
@@ -7,42 +7,33 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
7
7
|
function _ts_metadata(k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
}
|
|
10
|
-
import { extension } from "@decohere/
|
|
11
|
-
import { DefaultEnvironment } from "@decohere/
|
|
10
|
+
import { extension } from "@decohere/nexus/extensibility";
|
|
11
|
+
import { DefaultEnvironment } from "@decohere/nexus/system";
|
|
12
12
|
import { LoggingConfigurationError, scribe } from "@decohere/scribe";
|
|
13
|
-
import pino from "pino";
|
|
14
13
|
import { PinoAdapter } from "./pino.adapater.js";
|
|
15
|
-
import { pinoRecipe } from "./pino.recipe.js";
|
|
16
|
-
import { guardTransport } from "./pino.transport-guard.js";
|
|
17
|
-
export { guardTransport } from "./pino.transport-guard.js";
|
|
18
14
|
export class PinoExtensions {
|
|
19
15
|
static withPino(factory, config, logLevel) {
|
|
20
|
-
return configureScribe(factory,
|
|
16
|
+
return configureScribe(factory, {
|
|
21
17
|
logLevel
|
|
22
|
-
}
|
|
18
|
+
}, config);
|
|
23
19
|
}
|
|
24
|
-
static withPinoPretty(factory,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
roll: options,
|
|
34
|
-
logLevel: options.logLevel
|
|
35
|
-
});
|
|
20
|
+
static withPinoPretty(factory, logLevel) {
|
|
21
|
+
return PinoExtensions.withPino(factory, {
|
|
22
|
+
transports: {
|
|
23
|
+
target: "pino-pretty",
|
|
24
|
+
options: {
|
|
25
|
+
colorize: true
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}, logLevel);
|
|
36
29
|
}
|
|
37
30
|
static withPinoCustom(factory, options) {
|
|
38
|
-
const { scribe, transports } = options
|
|
31
|
+
const { scribe, transports } = options;
|
|
39
32
|
return configureScribe(factory, scribe, transports);
|
|
40
33
|
}
|
|
41
34
|
}
|
|
42
35
|
_ts_decorate([
|
|
43
|
-
extension(scribe,
|
|
44
|
-
static: true
|
|
45
|
-
}),
|
|
36
|
+
extension(scribe),
|
|
46
37
|
_ts_metadata("design:type", Function),
|
|
47
38
|
_ts_metadata("design:paramtypes", [
|
|
48
39
|
typeof scribe === "undefined" ? Object : scribe,
|
|
@@ -52,9 +43,7 @@ _ts_decorate([
|
|
|
52
43
|
_ts_metadata("design:returntype", void 0)
|
|
53
44
|
], PinoExtensions, "withPino", null);
|
|
54
45
|
_ts_decorate([
|
|
55
|
-
extension(scribe,
|
|
56
|
-
static: true
|
|
57
|
-
}),
|
|
46
|
+
extension(scribe),
|
|
58
47
|
_ts_metadata("design:type", Function),
|
|
59
48
|
_ts_metadata("design:paramtypes", [
|
|
60
49
|
typeof scribe === "undefined" ? Object : scribe,
|
|
@@ -63,20 +52,7 @@ _ts_decorate([
|
|
|
63
52
|
_ts_metadata("design:returntype", void 0)
|
|
64
53
|
], PinoExtensions, "withPinoPretty", null);
|
|
65
54
|
_ts_decorate([
|
|
66
|
-
extension(scribe,
|
|
67
|
-
static: true
|
|
68
|
-
}),
|
|
69
|
-
_ts_metadata("design:type", Function),
|
|
70
|
-
_ts_metadata("design:paramtypes", [
|
|
71
|
-
typeof scribe === "undefined" ? Object : scribe,
|
|
72
|
-
typeof PinoRollRecipeOptions === "undefined" ? Object : PinoRollRecipeOptions
|
|
73
|
-
]),
|
|
74
|
-
_ts_metadata("design:returntype", void 0)
|
|
75
|
-
], PinoExtensions, "withPinoRoll", null);
|
|
76
|
-
_ts_decorate([
|
|
77
|
-
extension(scribe, {
|
|
78
|
-
static: true
|
|
79
|
-
}),
|
|
55
|
+
extension(scribe),
|
|
80
56
|
_ts_metadata("design:type", Function),
|
|
81
57
|
_ts_metadata("design:paramtypes", [
|
|
82
58
|
typeof scribe === "undefined" ? Object : scribe,
|
|
@@ -84,85 +60,23 @@ _ts_decorate([
|
|
|
84
60
|
]),
|
|
85
61
|
_ts_metadata("design:returntype", void 0)
|
|
86
62
|
], PinoExtensions, "withPinoCustom", null);
|
|
87
|
-
function parsePrettyArg(logLevelOrOptions) {
|
|
88
|
-
if (logLevelOrOptions == null) {
|
|
89
|
-
return {};
|
|
90
|
-
}
|
|
91
|
-
if (typeof logLevelOrOptions === "string") {
|
|
92
|
-
return {
|
|
93
|
-
logLevel: logLevelOrOptions
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
return logLevelOrOptions;
|
|
97
|
-
}
|
|
98
|
-
function attachRecipe(factory, plan) {
|
|
99
|
-
const loggerFactory = applyRecipe(factory, plan);
|
|
100
|
-
const chain = {
|
|
101
|
-
withPinoPretty (logLevelOrOptions) {
|
|
102
|
-
const pretty = parsePrettyArg(logLevelOrOptions);
|
|
103
|
-
return attachRecipe(factory, {
|
|
104
|
-
...plan,
|
|
105
|
-
pretty: {
|
|
106
|
-
...plan.pretty,
|
|
107
|
-
...pretty
|
|
108
|
-
},
|
|
109
|
-
logLevel: pretty.logLevel ?? plan.logLevel
|
|
110
|
-
});
|
|
111
|
-
},
|
|
112
|
-
withPinoRoll (options) {
|
|
113
|
-
return attachRecipe(factory, {
|
|
114
|
-
...plan,
|
|
115
|
-
roll: options,
|
|
116
|
-
logLevel: options.logLevel ?? plan.logLevel
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
return Object.assign(loggerFactory, chain, {
|
|
121
|
-
and: chain
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Guard a worker transport so failures (roll EEXIST, worker exit) neither
|
|
126
|
-
* crash the process nor spam stderr on every subsequent log write.
|
|
127
|
-
*/ function createSafeTransport(options) {
|
|
128
|
-
return guardTransport(pino.transport(options));
|
|
129
|
-
}
|
|
130
|
-
function adapterForTransport(transport) {
|
|
131
|
-
if (transport == null) {
|
|
132
|
-
return new PinoAdapter({});
|
|
133
|
-
}
|
|
134
|
-
return new PinoAdapter({}, createSafeTransport(transport));
|
|
135
|
-
}
|
|
136
|
-
function applyRecipe(factory, plan) {
|
|
137
|
-
const adapter = adapterForTransport(pinoRecipe.transport(plan));
|
|
138
|
-
// Omit logLevel when unset so mergeDefaults can read LOG_LEVEL / SCRIBE_LOG_LEVEL.
|
|
139
|
-
return factory.configure({
|
|
140
|
-
options: plan.logLevel != null ? {
|
|
141
|
-
logLevel: plan.logLevel
|
|
142
|
-
} : {},
|
|
143
|
-
adapter
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
63
|
function configureScribe(factory, options, config) {
|
|
147
64
|
const environment = process.env.NODE_ENV ?? DefaultEnvironment;
|
|
148
|
-
const configs =
|
|
65
|
+
const configs = Array.isArray(config) ? config : [
|
|
149
66
|
config
|
|
150
|
-
]
|
|
151
|
-
|
|
67
|
+
];
|
|
68
|
+
const transports = configs.filter((config)=>config.environment && config.environment === environment || true);
|
|
69
|
+
if (transports.length > 1) {
|
|
152
70
|
throw new LoggingConfigurationError(`There should only be one configuration per environment for logging`);
|
|
153
71
|
}
|
|
154
|
-
const
|
|
155
|
-
|
|
72
|
+
const transport = transports.at(0)?.transports;
|
|
73
|
+
const adapter = new PinoAdapter({
|
|
74
|
+
transport
|
|
75
|
+
});
|
|
156
76
|
return factory.configure({
|
|
157
|
-
options
|
|
77
|
+
options,
|
|
158
78
|
adapter
|
|
159
79
|
});
|
|
160
80
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
export const pinoTransport = {
|
|
165
|
-
createSafeTransport,
|
|
166
|
-
guardTransport,
|
|
167
|
-
silenceErrors
|
|
168
|
-
};
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2RlY29oZXJlL2RlY29oZXJlL3Byb2plY3RzL3NjcmliZS9zY3JpYmUtcGluby9zcmMvc2NyaWJlLXBpbm8udHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgZXh0ZW5zaW9uIH0gZnJvbSBcIkBkZWNvaGVyZS9uZXh1cy9leHRlbnNpYmlsaXR5XCI7XG5pbXBvcnQgeyBEZWZhdWx0RW52aXJvbm1lbnQsIHR5cGUgRW52aXJvbm1lbnQgfSBmcm9tIFwiQGRlY29oZXJlL25leHVzL3N5c3RlbVwiO1xuaW1wb3J0IHtcblx0dHlwZSBEZWZhdWx0TGV2ZWxzLFxuXHR0eXBlIExvZ2dlcixcblx0TG9nZ2luZ0NvbmZpZ3VyYXRpb25FcnJvcixcblx0dHlwZSBTY3JpYmVPcHRpb25zLFxuXHRzY3JpYmUsXG59IGZyb20gXCJAZGVjb2hlcmUvc2NyaWJlXCI7XG5pbXBvcnQgdHlwZSB7XG5cdFRyYW5zcG9ydE11bHRpT3B0aW9ucyxcblx0VHJhbnNwb3J0UGlwZWxpbmVPcHRpb25zLFxuXHRUcmFuc3BvcnRTaW5nbGVPcHRpb25zLFxufSBmcm9tIFwicGlub1wiO1xuXG5pbX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ANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decohere/scribe-pino",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.14",
|
|
4
4
|
"description": "Pino adapter for @decohere/scribe",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -8,15 +8,6 @@
|
|
|
8
8
|
"pino",
|
|
9
9
|
"decohere"
|
|
10
10
|
],
|
|
11
|
-
"homepage": "https://github.com/typesmiths/decohere/tree/main/projects/scribe/scribe-pino#readme",
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/typesmiths/decohere/issues"
|
|
14
|
-
},
|
|
15
|
-
"repository": {
|
|
16
|
-
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/typesmiths/decohere.git",
|
|
18
|
-
"directory": "projects/scribe/scribe-pino"
|
|
19
|
-
},
|
|
20
11
|
"license": "ISC",
|
|
21
12
|
"author": "Typesmiths",
|
|
22
13
|
"type": "module",
|
|
@@ -32,21 +23,9 @@
|
|
|
32
23
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
33
24
|
},
|
|
34
25
|
"dependencies": {
|
|
35
|
-
"@decohere/
|
|
36
|
-
"@decohere/scribe": "0.0.1-dev.
|
|
26
|
+
"@decohere/nexus": "0.0.1-dev.14",
|
|
27
|
+
"@decohere/scribe": "0.0.1-dev.14",
|
|
37
28
|
"pino": "^10.3.0"
|
|
38
29
|
},
|
|
39
|
-
"devDependencies": {}
|
|
40
|
-
"peerDependencies": {
|
|
41
|
-
"pino-pretty": "^13.1.3",
|
|
42
|
-
"pino-roll": "^4.0.0"
|
|
43
|
-
},
|
|
44
|
-
"peerDependenciesMeta": {
|
|
45
|
-
"pino-pretty": {
|
|
46
|
-
"optional": true
|
|
47
|
-
},
|
|
48
|
-
"pino-roll": {
|
|
49
|
-
"optional": true
|
|
50
|
-
}
|
|
51
|
-
}
|
|
30
|
+
"devDependencies": {}
|
|
52
31
|
}
|
package/types/src/index.d.ts
CHANGED
|
@@ -8,16 +8,8 @@ export declare class PinoAdapter extends LogAdapter {
|
|
|
8
8
|
private _pino;
|
|
9
9
|
private readonly options;
|
|
10
10
|
private readonly stream;
|
|
11
|
-
private disposed;
|
|
12
|
-
private retired;
|
|
13
11
|
constructor(options: pino.LoggerOptions, stream?: pino.DestinationStream);
|
|
14
12
|
configure<T extends string = never, CustomOnly extends true | false = false>(scribeOptions: ScribeOptions<T, CustomOnly>): void;
|
|
15
13
|
getLogger<T extends string = never, CustomOnly extends true | false = false>(name: string): Logger<T, CustomOnly>;
|
|
16
14
|
flush(cb?: () => void): void;
|
|
17
|
-
/**
|
|
18
|
-
* Immediately stop accepting writes into the destination (ThreadStream).
|
|
19
|
-
* Does not wait for flush — use `stop()` for async drain after retire.
|
|
20
|
-
*/
|
|
21
|
-
retire(): void;
|
|
22
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
23
15
|
}
|
|
@@ -1,72 +1,24 @@
|
|
|
1
|
-
import { type Environment } from "@decohere/
|
|
1
|
+
import { type Environment } from "@decohere/nexus/system";
|
|
2
2
|
import { type DefaultLevels, type Logger, type ScribeOptions, scribe } from "@decohere/scribe";
|
|
3
|
-
import
|
|
4
|
-
import { type PinoPrettyRecipeOptions, type PinoRollRecipeOptions } from "./pino.recipe.js";
|
|
5
|
-
import { type GuardedTransport, guardTransport } from "./pino.transport-guard.js";
|
|
6
|
-
export type { GuardedTransport } from "./pino.transport-guard.js";
|
|
7
|
-
export { guardTransport } from "./pino.transport-guard.js";
|
|
8
|
-
type TransportOptions = TransportSingleOptions | TransportMultiOptions | TransportPipelineOptions;
|
|
3
|
+
import type { TransportMultiOptions, TransportPipelineOptions, TransportSingleOptions } from "pino";
|
|
9
4
|
type TransportConfig = {
|
|
10
5
|
environment?: Environment;
|
|
11
|
-
transports:
|
|
6
|
+
transports: TransportSingleOptions | TransportMultiOptions | TransportPipelineOptions;
|
|
12
7
|
};
|
|
13
8
|
type CustomLevelOptions<T extends string = never, CustomOnly extends true = undefined> = {
|
|
14
9
|
scribe?: ScribeOptions<T, CustomOnly>;
|
|
15
10
|
transports?: TransportConfig | TransportConfig[];
|
|
16
11
|
};
|
|
17
|
-
export type PinoLoggerFactory = (name?: string) => Logger;
|
|
18
|
-
export type PinoRecipeChain = {
|
|
19
|
-
withPinoPretty(logLevelOrOptions?: DefaultLevels | string | PinoPrettyRecipeOptions): PinoRecipe;
|
|
20
|
-
withPinoRoll(options: PinoRollRecipeOptions): PinoRecipe;
|
|
21
|
-
};
|
|
22
|
-
export type PinoRecipe = PinoLoggerFactory & PinoRecipeChain & {
|
|
23
|
-
readonly and: PinoRecipeChain;
|
|
24
|
-
};
|
|
25
12
|
declare module "@decohere/scribe" {
|
|
26
13
|
interface scribe {
|
|
27
|
-
withPino(transports: TransportConfig | TransportConfig[], loglevel?: DefaultLevels | string):
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* Chain with `.and.withPinoRoll({ file })`. Production writes JSON to stdout
|
|
31
|
-
* so log shipping stays outside the process.
|
|
32
|
-
*/
|
|
33
|
-
withPinoPretty(logLevelOrOptions?: DefaultLevels | string | PinoPrettyRecipeOptions): PinoRecipe;
|
|
34
|
-
/**
|
|
35
|
-
* Rolling log files. Development only unless `{ when: "always" }`.
|
|
36
|
-
* Do not enable in production — ship stdout from a sidecar or platform agent.
|
|
37
|
-
* `symlink` defaults off; enabling it can race under multi-worker / HMR.
|
|
38
|
-
* Ops may override path/size/frequency/keep via `SCRIBE_LOG_FILE`,
|
|
39
|
-
* `SCRIBE_LOG_SIZE`, `SCRIBE_LOG_FREQUENCY`, and `SCRIBE_LOG_KEEP`
|
|
40
|
-
* (file env wins over `options.file`; other explicit options beat env).
|
|
41
|
-
*/
|
|
42
|
-
withPinoRoll(options: PinoRollRecipeOptions): PinoRecipe;
|
|
43
|
-
withPinoCustom<T extends string = never, CustomOnly extends true = undefined>(options?: CustomLevelOptions<T, CustomOnly>): PinoLoggerFactory;
|
|
44
|
-
}
|
|
45
|
-
namespace scribe {
|
|
46
|
-
function withPino(transports: TransportConfig | TransportConfig[], loglevel?: DefaultLevels | string): PinoLoggerFactory;
|
|
47
|
-
function withPinoPretty(logLevelOrOptions?: DefaultLevels | string | PinoPrettyRecipeOptions): PinoRecipe;
|
|
48
|
-
function withPinoRoll(options: PinoRollRecipeOptions): PinoRecipe;
|
|
49
|
-
function withPinoCustom<T extends string = never, CustomOnly extends true = undefined>(options?: CustomLevelOptions<T, CustomOnly>): PinoLoggerFactory;
|
|
14
|
+
withPino(transports: TransportConfig | TransportConfig[], loglevel?: DefaultLevels | string): (name?: string) => Logger;
|
|
15
|
+
withPinoPretty(logLevel?: DefaultLevels | string): (name?: string) => Logger;
|
|
16
|
+
withPinoCustom<T extends string = never, CustomOnly extends true = undefined>(options?: CustomLevelOptions<T, CustomOnly>): (name?: string) => Logger<T, CustomOnly>;
|
|
50
17
|
}
|
|
51
18
|
}
|
|
52
19
|
export declare class PinoExtensions {
|
|
53
20
|
static withPino(factory: scribe, config: TransportConfig | TransportConfig[], logLevel?: DefaultLevels | string): (name?: string) => Logger<never, false>;
|
|
54
|
-
static withPinoPretty(factory: scribe,
|
|
55
|
-
static withPinoRoll(factory: scribe, options: PinoRollRecipeOptions): PinoRecipe;
|
|
21
|
+
static withPinoPretty(factory: scribe, logLevel?: DefaultLevels | string): (name?: string) => Logger<never, false>;
|
|
56
22
|
static withPinoCustom<T extends string = never, CustomOnly extends true = undefined>(factory: scribe, options?: CustomLevelOptions<T, CustomOnly>): (name?: string) => Logger<T, CustomOnly>;
|
|
57
23
|
}
|
|
58
|
-
|
|
59
|
-
* Guard a worker transport so failures (roll EEXIST, worker exit) neither
|
|
60
|
-
* crash the process nor spam stderr on every subsequent log write.
|
|
61
|
-
*/
|
|
62
|
-
declare function createSafeTransport(options: TransportOptions): DestinationStream;
|
|
63
|
-
/** @deprecated Use {@link guardTransport} — kept for callers/tests from the silence-only era. */
|
|
64
|
-
declare function silenceErrors(transport: {
|
|
65
|
-
on(event: "error", listener: (err: Error) => void): unknown;
|
|
66
|
-
write?: (...args: never[]) => unknown;
|
|
67
|
-
}): GuardedTransport;
|
|
68
|
-
export declare const pinoTransport: {
|
|
69
|
-
createSafeTransport: typeof createSafeTransport;
|
|
70
|
-
guardTransport: typeof guardTransport;
|
|
71
|
-
silenceErrors: typeof silenceErrors;
|
|
72
|
-
};
|
|
24
|
+
export {};
|
package/LICENSE
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
ISC License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025-2026 Typesmiths
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
-
copyright notice and this permission notice appear in all copies.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "pinoRecipe", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return pinoRecipe;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _system = require("@decohere/core/system");
|
|
12
|
-
const DEFAULT_ROLL_SIZE = "10m";
|
|
13
|
-
const DEFAULT_ROLL_FREQUENCY = "daily";
|
|
14
|
-
const DEFAULT_ROLL_KEEP = 14;
|
|
15
|
-
const ENV_LOG_FILE = "SCRIBE_LOG_FILE";
|
|
16
|
-
const ENV_LOG_SIZE = "SCRIBE_LOG_SIZE";
|
|
17
|
-
const ENV_LOG_FREQUENCY = "SCRIBE_LOG_FREQUENCY";
|
|
18
|
-
const ENV_LOG_KEEP = "SCRIBE_LOG_KEEP";
|
|
19
|
-
function currentEnvironment() {
|
|
20
|
-
return process.env.NODE_ENV === _system.Environments.production ? _system.Environments.production : _system.Environments.development;
|
|
21
|
-
}
|
|
22
|
-
function isEnabled(when, environment) {
|
|
23
|
-
return (when ?? "development") === "always" || environment === _system.Environments.development;
|
|
24
|
-
}
|
|
25
|
-
function envString(name) {
|
|
26
|
-
const value = process.env[name]?.trim();
|
|
27
|
-
return value ? value : undefined;
|
|
28
|
-
}
|
|
29
|
-
function envFrequency() {
|
|
30
|
-
const raw = envString(ENV_LOG_FREQUENCY);
|
|
31
|
-
if (raw == null) {
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
if (/^\d+$/.test(raw)) {
|
|
35
|
-
return Number(raw);
|
|
36
|
-
}
|
|
37
|
-
return raw;
|
|
38
|
-
}
|
|
39
|
-
function envKeep() {
|
|
40
|
-
const raw = envString(ENV_LOG_KEEP);
|
|
41
|
-
if (raw == null) {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
const keep = Number(raw);
|
|
45
|
-
return Number.isFinite(keep) && keep >= 0 ? keep : undefined;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Resolve roll options. `SCRIBE_LOG_FILE` overrides `file` so ops can redirect
|
|
49
|
-
* without touching app code. Size / frequency / keep: explicit > env > default.
|
|
50
|
-
*/ function resolveRoll(options) {
|
|
51
|
-
return {
|
|
52
|
-
file: envString(ENV_LOG_FILE) ?? options.file,
|
|
53
|
-
size: options.size ?? envString(ENV_LOG_SIZE) ?? DEFAULT_ROLL_SIZE,
|
|
54
|
-
frequency: options.frequency ?? envFrequency() ?? DEFAULT_ROLL_FREQUENCY,
|
|
55
|
-
keep: options.keep ?? envKeep() ?? DEFAULT_ROLL_KEEP,
|
|
56
|
-
mkdir: options.mkdir ?? true,
|
|
57
|
-
symlink: options.symlink ?? false
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
function prettyTarget(options) {
|
|
61
|
-
return {
|
|
62
|
-
target: "pino-pretty",
|
|
63
|
-
options: {
|
|
64
|
-
colorize: options.colorize ?? true
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function rollTarget(options) {
|
|
69
|
-
const roll = resolveRoll(options);
|
|
70
|
-
return {
|
|
71
|
-
target: "pino-roll",
|
|
72
|
-
options: {
|
|
73
|
-
file: roll.file,
|
|
74
|
-
mkdir: roll.mkdir,
|
|
75
|
-
size: roll.size,
|
|
76
|
-
frequency: roll.frequency,
|
|
77
|
-
limit: {
|
|
78
|
-
count: roll.keep
|
|
79
|
-
},
|
|
80
|
-
symlink: roll.symlink
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function transport(plan, environment = currentEnvironment()) {
|
|
85
|
-
const targets = [];
|
|
86
|
-
if (plan.pretty && isEnabled(plan.pretty.when, environment)) {
|
|
87
|
-
targets.push(prettyTarget(plan.pretty));
|
|
88
|
-
}
|
|
89
|
-
if (plan.roll && isEnabled(plan.roll.when, environment)) {
|
|
90
|
-
targets.push(rollTarget(plan.roll));
|
|
91
|
-
}
|
|
92
|
-
if (targets.length === 0) {
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
if (targets.length === 1) {
|
|
96
|
-
return targets[0];
|
|
97
|
-
}
|
|
98
|
-
return {
|
|
99
|
-
targets
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
const pinoRecipe = {
|
|
103
|
-
transport,
|
|
104
|
-
currentEnvironment,
|
|
105
|
-
resolveRoll
|
|
106
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "guardTransport", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return guardTransport;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
function guardTransport(transport) {
|
|
12
|
-
const stream = transport;
|
|
13
|
-
let retired = false;
|
|
14
|
-
let reported = false;
|
|
15
|
-
const retire = (reason = "retired")=>{
|
|
16
|
-
if (retired) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
retired = true;
|
|
20
|
-
if (!reported) {
|
|
21
|
-
reported = true;
|
|
22
|
-
process.stderr.write(`[scribe-pino] transport retired: ${reason}\n`);
|
|
23
|
-
}
|
|
24
|
-
if (typeof stream.destroy === "function") {
|
|
25
|
-
try {
|
|
26
|
-
stream.destroy();
|
|
27
|
-
} catch {
|
|
28
|
-
// already dead
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
if (typeof stream.on === "function") {
|
|
33
|
-
stream.on("error", (err)=>{
|
|
34
|
-
retire(err?.message ?? String(err));
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
if (typeof stream.write === "function") {
|
|
38
|
-
const originalWrite = stream.write.bind(stream);
|
|
39
|
-
stream.write = (chunk, encodingOrCb, cb)=>{
|
|
40
|
-
if (retired) {
|
|
41
|
-
completeWrite(encodingOrCb, cb);
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
try {
|
|
45
|
-
return originalWrite(chunk, encodingOrCb, cb);
|
|
46
|
-
} catch (err) {
|
|
47
|
-
retire(err instanceof Error ? err.message : String(err));
|
|
48
|
-
completeWrite(encodingOrCb, cb);
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
Object.defineProperty(stream, "retired", {
|
|
54
|
-
get: ()=>retired,
|
|
55
|
-
enumerable: true
|
|
56
|
-
});
|
|
57
|
-
Object.defineProperty(stream, "retire", {
|
|
58
|
-
value: retire,
|
|
59
|
-
enumerable: true
|
|
60
|
-
});
|
|
61
|
-
return stream;
|
|
62
|
-
}
|
|
63
|
-
function completeWrite(encodingOrCb, cb) {
|
|
64
|
-
const done = typeof encodingOrCb === "function" ? encodingOrCb : typeof cb === "function" ? cb : undefined;
|
|
65
|
-
if (typeof done === "function") {
|
|
66
|
-
done();
|
|
67
|
-
}
|
|
68
|
-
}
|
package/es6/src/pino.recipe.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { Environments } from "@decohere/core/system";
|
|
2
|
-
const DEFAULT_ROLL_SIZE = "10m";
|
|
3
|
-
const DEFAULT_ROLL_FREQUENCY = "daily";
|
|
4
|
-
const DEFAULT_ROLL_KEEP = 14;
|
|
5
|
-
const ENV_LOG_FILE = "SCRIBE_LOG_FILE";
|
|
6
|
-
const ENV_LOG_SIZE = "SCRIBE_LOG_SIZE";
|
|
7
|
-
const ENV_LOG_FREQUENCY = "SCRIBE_LOG_FREQUENCY";
|
|
8
|
-
const ENV_LOG_KEEP = "SCRIBE_LOG_KEEP";
|
|
9
|
-
function currentEnvironment() {
|
|
10
|
-
return process.env.NODE_ENV === Environments.production ? Environments.production : Environments.development;
|
|
11
|
-
}
|
|
12
|
-
function isEnabled(when, environment) {
|
|
13
|
-
return (when ?? "development") === "always" || environment === Environments.development;
|
|
14
|
-
}
|
|
15
|
-
function envString(name) {
|
|
16
|
-
const value = process.env[name]?.trim();
|
|
17
|
-
return value ? value : undefined;
|
|
18
|
-
}
|
|
19
|
-
function envFrequency() {
|
|
20
|
-
const raw = envString(ENV_LOG_FREQUENCY);
|
|
21
|
-
if (raw == null) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
if (/^\d+$/.test(raw)) {
|
|
25
|
-
return Number(raw);
|
|
26
|
-
}
|
|
27
|
-
return raw;
|
|
28
|
-
}
|
|
29
|
-
function envKeep() {
|
|
30
|
-
const raw = envString(ENV_LOG_KEEP);
|
|
31
|
-
if (raw == null) {
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
const keep = Number(raw);
|
|
35
|
-
return Number.isFinite(keep) && keep >= 0 ? keep : undefined;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Resolve roll options. `SCRIBE_LOG_FILE` overrides `file` so ops can redirect
|
|
39
|
-
* without touching app code. Size / frequency / keep: explicit > env > default.
|
|
40
|
-
*/ function resolveRoll(options) {
|
|
41
|
-
return {
|
|
42
|
-
file: envString(ENV_LOG_FILE) ?? options.file,
|
|
43
|
-
size: options.size ?? envString(ENV_LOG_SIZE) ?? DEFAULT_ROLL_SIZE,
|
|
44
|
-
frequency: options.frequency ?? envFrequency() ?? DEFAULT_ROLL_FREQUENCY,
|
|
45
|
-
keep: options.keep ?? envKeep() ?? DEFAULT_ROLL_KEEP,
|
|
46
|
-
mkdir: options.mkdir ?? true,
|
|
47
|
-
symlink: options.symlink ?? false
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function prettyTarget(options) {
|
|
51
|
-
return {
|
|
52
|
-
target: "pino-pretty",
|
|
53
|
-
options: {
|
|
54
|
-
colorize: options.colorize ?? true
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function rollTarget(options) {
|
|
59
|
-
const roll = resolveRoll(options);
|
|
60
|
-
return {
|
|
61
|
-
target: "pino-roll",
|
|
62
|
-
options: {
|
|
63
|
-
file: roll.file,
|
|
64
|
-
mkdir: roll.mkdir,
|
|
65
|
-
size: roll.size,
|
|
66
|
-
frequency: roll.frequency,
|
|
67
|
-
limit: {
|
|
68
|
-
count: roll.keep
|
|
69
|
-
},
|
|
70
|
-
symlink: roll.symlink
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function transport(plan, environment = currentEnvironment()) {
|
|
75
|
-
const targets = [];
|
|
76
|
-
if (plan.pretty && isEnabled(plan.pretty.when, environment)) {
|
|
77
|
-
targets.push(prettyTarget(plan.pretty));
|
|
78
|
-
}
|
|
79
|
-
if (plan.roll && isEnabled(plan.roll.when, environment)) {
|
|
80
|
-
targets.push(rollTarget(plan.roll));
|
|
81
|
-
}
|
|
82
|
-
if (targets.length === 0) {
|
|
83
|
-
return undefined;
|
|
84
|
-
}
|
|
85
|
-
if (targets.length === 1) {
|
|
86
|
-
return targets[0];
|
|
87
|
-
}
|
|
88
|
-
return {
|
|
89
|
-
targets
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
export const pinoRecipe = {
|
|
93
|
-
transport,
|
|
94
|
-
currentEnvironment,
|
|
95
|
-
resolveRoll
|
|
96
|
-
};
|