@webiny/logger 6.0.0-beta.0 → 6.0.0-rc.0
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/README.md +10 -14
- package/index.d.ts +5 -61
- package/index.js +11 -33
- package/index.js.map +1 -1
- package/package.json +7 -19
package/README.md
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
# @webiny/logger
|
|
2
|
-
|
|
3
|
-
[!
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Or if you prefer yarn:
|
|
13
|
-
```
|
|
14
|
-
yarn add @webiny/logger
|
|
15
|
-
```
|
|
2
|
+
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> This package is part of the [Webiny](https://www.webiny.com) monorepo.
|
|
5
|
+
> It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
|
|
6
|
+
|
|
7
|
+
📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
_This README file is automatically generated during the publish process._
|
package/index.d.ts
CHANGED
|
@@ -1,71 +1,15 @@
|
|
|
1
|
-
import { DestinationStream, LevelWithSilent, Logger, LoggerOptions
|
|
2
|
-
export
|
|
1
|
+
import type { DestinationStream, LevelWithSilent, Logger, LoggerOptions } from "pino";
|
|
2
|
+
export { pino, levels, version, stdSerializers, symbols, stdTimeFunctions, multistream, destination, transport } from "pino";
|
|
3
|
+
export type { DestinationStream, Logger, LogFn, WriteFn, BaseLogger, TransportTargetOptions, TransportSingleOptions, TransportPipelineOptions, TransportMultiOptions, TransportBaseOptions, TimeFn, ThreadStream, StreamEntry, SerializerFn, SerializedResponse, SerializedRequest, SerializedError, Bindings, ChildLoggerOptions, CustomLevelLogger, LoggerOptions, DestinationStreamHasMetadata, DestinationStreamWithMetadata, Level, LevelChangeEventListener, LevelMapping, LevelOrString, LevelWithSilent, redactOptions, PlaceholderTypeMapping, PlaceholderSpecifier, ParseLogFnArgs, OnChildCallback, MultiStreamRes, MultiStreamOptions, MixinMergeStrategyFn, MixinFn, LoggerExtras, LogEvent, LogDescriptor, LevelWithSilentOrString } from "pino";
|
|
3
4
|
export interface RedactOptions {
|
|
4
5
|
paths: string[];
|
|
5
6
|
censor?: string | ((value: any, path: string[]) => any);
|
|
6
7
|
remove?: boolean;
|
|
7
8
|
}
|
|
8
|
-
export interface LoggerOptions extends Omit<BaseLoggerOptions, "redact"> {
|
|
9
|
-
redact?: string[] | RedactOptions;
|
|
10
|
-
}
|
|
11
9
|
/**
|
|
12
10
|
* Gets the log level from the input or the LOG_LEVEL environment variable.
|
|
13
11
|
*/
|
|
14
12
|
export declare const getLogLevel: (input?: string, defaultLevel?: LevelWithSilent) => string;
|
|
15
|
-
export declare const createPinoLogger: (input?: LoggerOptions, stream?: DestinationStream) => Logger
|
|
16
|
-
level: string;
|
|
17
|
-
redact?: RedactOptions | string[] | undefined;
|
|
18
|
-
transport?: pino.TransportSingleOptions<Record<string, any>> | pino.TransportMultiOptions<Record<string, any>> | pino.TransportPipelineOptions<Record<string, any>> | undefined;
|
|
19
|
-
safe?: boolean | undefined;
|
|
20
|
-
name?: string | undefined;
|
|
21
|
-
serializers?: {
|
|
22
|
-
[key: string]: pino.SerializerFn;
|
|
23
|
-
} | undefined;
|
|
24
|
-
timestamp?: boolean | (() => string) | undefined;
|
|
25
|
-
customLevels?: {
|
|
26
|
-
[key: string]: number;
|
|
27
|
-
} | undefined;
|
|
28
|
-
useOnlyCustomLevels?: boolean | undefined;
|
|
29
|
-
mixin?: ((mergeObject: object, level: number) => object) | undefined;
|
|
30
|
-
mixinMergeStrategy?: ((mergeObject: object, mixinObject: object) => object) | undefined;
|
|
31
|
-
levelVal?: number | undefined;
|
|
32
|
-
messageKey?: string | undefined;
|
|
33
|
-
errorKey?: string | undefined;
|
|
34
|
-
nestedKey?: string | undefined;
|
|
35
|
-
enabled?: boolean | undefined;
|
|
36
|
-
browser?: {
|
|
37
|
-
asObject?: boolean | undefined;
|
|
38
|
-
write?: pino.WriteFn | ({
|
|
39
|
-
fatal?: pino.WriteFn | undefined;
|
|
40
|
-
error?: pino.WriteFn | undefined;
|
|
41
|
-
warn?: pino.WriteFn | undefined;
|
|
42
|
-
info?: pino.WriteFn | undefined;
|
|
43
|
-
debug?: pino.WriteFn | undefined;
|
|
44
|
-
trace?: pino.WriteFn | undefined;
|
|
45
|
-
} & {
|
|
46
|
-
[logLevel: string]: pino.WriteFn;
|
|
47
|
-
}) | undefined;
|
|
48
|
-
serialize?: boolean | string[] | undefined;
|
|
49
|
-
transmit?: {
|
|
50
|
-
level?: string | undefined;
|
|
51
|
-
send: (level: pino.Level, logEvent: pino.LogEvent) => void;
|
|
52
|
-
} | undefined;
|
|
53
|
-
} | undefined;
|
|
54
|
-
base?: {
|
|
55
|
-
[key: string]: any;
|
|
56
|
-
} | null | undefined;
|
|
57
|
-
formatters?: {
|
|
58
|
-
level?: ((label: string, number: number) => object) | undefined;
|
|
59
|
-
bindings?: ((bindings: pino.Bindings) => object) | undefined;
|
|
60
|
-
log?: ((object: Record<string, unknown>) => Record<string, unknown>) | undefined;
|
|
61
|
-
} | undefined;
|
|
62
|
-
msgPrefix?: string | undefined;
|
|
63
|
-
hooks?: {
|
|
64
|
-
logMethod?: ((this: pino.Logger<pino.LoggerOptions>, args: [msg: string, ...args: any[]], method: pino.LogFn, level: number) => void) | undefined;
|
|
65
|
-
} | undefined;
|
|
66
|
-
depthLimit?: number | undefined;
|
|
67
|
-
edgeLimit?: number | undefined;
|
|
68
|
-
onChild?: (<ChildOptions extends pino.ChildLoggerOptions>(child: pino.Logger<BaseLoggerOptions & ChildOptions>) => void) | undefined;
|
|
69
|
-
}>;
|
|
13
|
+
export declare const createPinoLogger: (input?: LoggerOptions, stream?: DestinationStream) => Logger;
|
|
70
14
|
export declare const configureLogger: (options: LoggerOptions, stream?: DestinationStream) => void;
|
|
71
|
-
export declare const getLogger: () => Logger
|
|
15
|
+
export declare const getLogger: () => Logger;
|
package/index.js
CHANGED
|
@@ -1,61 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
import { pino } from "pino";
|
|
2
|
+
export { pino, levels, version, stdSerializers, symbols, stdTimeFunctions, multistream, destination, transport } from "pino";
|
|
3
|
+
// export interface LoggerOptions extends Omit<BaseLoggerOptions, "redact"> {
|
|
4
|
+
// redact?: string[] | RedactOptions;
|
|
5
|
+
// }
|
|
2
6
|
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
getLogLevel: true,
|
|
8
|
-
createPinoLogger: true,
|
|
9
|
-
configureLogger: true,
|
|
10
|
-
getLogger: true
|
|
11
|
-
};
|
|
12
|
-
exports.getLogger = exports.getLogLevel = exports.createPinoLogger = exports.configureLogger = void 0;
|
|
13
|
-
var _pino = require("pino");
|
|
14
|
-
Object.keys(_pino).forEach(function (key) {
|
|
15
|
-
if (key === "default" || key === "__esModule") return;
|
|
16
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
17
|
-
if (key in exports && exports[key] === _pino[key]) return;
|
|
18
|
-
Object.defineProperty(exports, key, {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _pino[key];
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
7
|
const levels = ["fatal", "error", "warn", "info", "debug", "trace", "silent"];
|
|
26
8
|
/**
|
|
27
9
|
* Gets the log level from the input or the LOG_LEVEL environment variable.
|
|
28
10
|
*/
|
|
29
|
-
const getLogLevel = (input, defaultLevel = "info") => {
|
|
11
|
+
export const getLogLevel = (input, defaultLevel = "info") => {
|
|
30
12
|
input = input || process.env.LOG_LEVEL;
|
|
31
13
|
if (!input || input.length === 0) {
|
|
32
14
|
return defaultLevel;
|
|
33
15
|
}
|
|
34
16
|
return levels.includes(input) ? input : defaultLevel;
|
|
35
17
|
};
|
|
36
|
-
exports.getLogLevel = getLogLevel;
|
|
37
18
|
let logger;
|
|
38
|
-
const createPinoLogger = (input, stream) => {
|
|
19
|
+
export const createPinoLogger = (input, stream) => {
|
|
39
20
|
const options = {
|
|
40
21
|
...(input || {}),
|
|
41
22
|
level: getLogLevel(input?.level)
|
|
42
23
|
};
|
|
43
24
|
if (!stream) {
|
|
44
|
-
return
|
|
25
|
+
return pino(options);
|
|
45
26
|
}
|
|
46
|
-
return
|
|
27
|
+
return pino(options, stream);
|
|
47
28
|
};
|
|
48
|
-
|
|
49
|
-
const configureLogger = (options, stream) => {
|
|
29
|
+
export const configureLogger = (options, stream) => {
|
|
50
30
|
logger = createPinoLogger(options, stream);
|
|
51
31
|
};
|
|
52
|
-
|
|
53
|
-
const getLogger = () => {
|
|
32
|
+
export const getLogger = () => {
|
|
54
33
|
if (!logger) {
|
|
55
34
|
logger = createPinoLogger();
|
|
56
35
|
}
|
|
57
36
|
return logger;
|
|
58
37
|
};
|
|
59
|
-
exports.getLogger = getLogger;
|
|
60
38
|
|
|
61
39
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["pino","levels","version","stdSerializers","symbols","stdTimeFunctions","multistream","destination","transport","getLogLevel","input","defaultLevel","process","env","LOG_LEVEL","length","includes","logger","createPinoLogger","stream","options","level","configureLogger","getLogger"],"sources":["index.ts"],"sourcesContent":["import type { DestinationStream, LevelWithSilent, Logger, LoggerOptions } from \"pino\";\nimport { pino } from \"pino\";\n\nexport {\n pino,\n levels,\n version,\n stdSerializers,\n symbols,\n stdTimeFunctions,\n multistream,\n destination,\n transport\n} from \"pino\";\nexport type {\n DestinationStream,\n Logger,\n LogFn,\n WriteFn,\n BaseLogger,\n TransportTargetOptions,\n TransportSingleOptions,\n TransportPipelineOptions,\n TransportMultiOptions,\n TransportBaseOptions,\n TimeFn,\n ThreadStream,\n StreamEntry,\n SerializerFn,\n SerializedResponse,\n SerializedRequest,\n SerializedError,\n Bindings,\n ChildLoggerOptions,\n CustomLevelLogger,\n LoggerOptions,\n DestinationStreamHasMetadata,\n DestinationStreamWithMetadata,\n Level,\n LevelChangeEventListener,\n LevelMapping,\n LevelOrString,\n LevelWithSilent,\n redactOptions,\n PlaceholderTypeMapping,\n PlaceholderSpecifier,\n ParseLogFnArgs,\n OnChildCallback,\n MultiStreamRes,\n MultiStreamOptions,\n MixinMergeStrategyFn,\n MixinFn,\n LoggerExtras,\n LogEvent,\n LogDescriptor,\n LevelWithSilentOrString\n} from \"pino\";\n\nexport interface RedactOptions {\n paths: string[];\n censor?: string | ((value: any, path: string[]) => any);\n remove?: boolean;\n}\n\n// export interface LoggerOptions extends Omit<BaseLoggerOptions, \"redact\"> {\n// redact?: string[] | RedactOptions;\n// }\n\nconst levels: LevelWithSilent[] = [\"fatal\", \"error\", \"warn\", \"info\", \"debug\", \"trace\", \"silent\"];\n/**\n * Gets the log level from the input or the LOG_LEVEL environment variable.\n */\nexport const getLogLevel = (input?: string, defaultLevel: LevelWithSilent = \"info\"): string => {\n input = input || process.env.LOG_LEVEL;\n if (!input || input.length === 0) {\n return defaultLevel;\n }\n return levels.includes(input as LevelWithSilent) ? input : defaultLevel;\n};\n\nlet logger: Logger;\n\nexport const createPinoLogger = (input?: LoggerOptions, stream?: DestinationStream): Logger => {\n const options = {\n ...(input || {}),\n level: getLogLevel(input?.level)\n };\n if (!stream) {\n return pino(options);\n }\n return pino(options, stream);\n};\n\nexport const configureLogger = (options: LoggerOptions, stream?: DestinationStream): void => {\n logger = createPinoLogger(options, stream);\n};\n\nexport const getLogger = () => {\n if (!logger) {\n logger = createPinoLogger();\n }\n return logger;\n};\n"],"mappings":"AACA,SAASA,IAAI,QAAQ,MAAM;AAE3B,SACIA,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,cAAc,EACdC,OAAO,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 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/logger",
|
|
3
|
-
"version": "6.0.0-
|
|
3
|
+
"version": "6.0.0-rc.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"main": "index.js",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
@@ -11,28 +12,15 @@
|
|
|
11
12
|
"Bruno Zorić <bruno@webiny.com>"
|
|
12
13
|
],
|
|
13
14
|
"license": "MIT",
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"@babel/runtime": "7.24.1"
|
|
16
|
-
},
|
|
17
15
|
"devDependencies": {
|
|
18
|
-
"@
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"@webiny/cli": "6.0.0-beta.0",
|
|
23
|
-
"@webiny/project-utils": "6.0.0-beta.0",
|
|
24
|
-
"pino": "8.11.0",
|
|
25
|
-
"rimraf": "5.0.5",
|
|
26
|
-
"ttypescript": "1.5.15",
|
|
27
|
-
"typescript": "4.7.4"
|
|
16
|
+
"@webiny/build-tools": "6.0.0-rc.0",
|
|
17
|
+
"pino": "9.14.0",
|
|
18
|
+
"rimraf": "6.1.3",
|
|
19
|
+
"typescript": "5.9.3"
|
|
28
20
|
},
|
|
29
21
|
"publishConfig": {
|
|
30
22
|
"access": "public",
|
|
31
23
|
"directory": "dist"
|
|
32
24
|
},
|
|
33
|
-
"
|
|
34
|
-
"build": "yarn webiny run build",
|
|
35
|
-
"watch": "yarn webiny run watch"
|
|
36
|
-
},
|
|
37
|
-
"gitHead": "aa8dbfbbd5ad13ec271adba6f2431e02991a300f"
|
|
25
|
+
"gitHead": "0f2aa699f4642e550ab62c96fcd050e8d02345c9"
|
|
38
26
|
}
|