@webiny/logger 5.38.5 → 5.38.6
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/index.d.ts +21 -21
- package/index.js +5 -4
- package/index.js.map +1 -1
- package/package.json +4 -4
package/index.d.ts
CHANGED
|
@@ -15,11 +15,25 @@ export declare const getLogLevel: (input?: string, defaultLevel?: LevelWithSilen
|
|
|
15
15
|
export declare const createPinoLogger: (input?: LoggerOptions, stream?: DestinationStream) => Logger<{
|
|
16
16
|
level: string;
|
|
17
17
|
redact?: string[] | RedactOptions | undefined;
|
|
18
|
-
transport?: pino.TransportSingleOptions<Record<string, any>> | pino.TransportMultiOptions<Record<string, any>> | pino.TransportPipelineOptions<Record<string, any>> | undefined;
|
|
19
18
|
name?: string | undefined;
|
|
20
|
-
|
|
21
|
-
[key: string]:
|
|
22
|
-
} |
|
|
19
|
+
customLevels?: {
|
|
20
|
+
[key: string]: number;
|
|
21
|
+
} | undefined;
|
|
22
|
+
useOnlyCustomLevels?: boolean | undefined;
|
|
23
|
+
levelVal?: number | undefined;
|
|
24
|
+
onChild?: (<ChildOptions extends pino.ChildLoggerOptions>(child: pino.Logger<BaseLoggerOptions & ChildOptions>) => void) | undefined;
|
|
25
|
+
transport?: pino.TransportSingleOptions<Record<string, any>> | pino.TransportMultiOptions<Record<string, any>> | pino.TransportPipelineOptions<Record<string, any>> | undefined;
|
|
26
|
+
safe?: boolean | undefined;
|
|
27
|
+
serializers?: {
|
|
28
|
+
[key: string]: pino.SerializerFn;
|
|
29
|
+
} | undefined;
|
|
30
|
+
timestamp?: boolean | (() => string) | undefined;
|
|
31
|
+
mixin?: ((mergeObject: object, level: number) => object) | undefined;
|
|
32
|
+
mixinMergeStrategy?: ((mergeObject: object, mixinObject: object) => object) | undefined;
|
|
33
|
+
messageKey?: string | undefined;
|
|
34
|
+
errorKey?: string | undefined;
|
|
35
|
+
nestedKey?: string | undefined;
|
|
36
|
+
enabled?: boolean | undefined;
|
|
23
37
|
browser?: {
|
|
24
38
|
asObject?: boolean | undefined;
|
|
25
39
|
write?: pino.WriteFn | ({
|
|
@@ -38,23 +52,9 @@ export declare const createPinoLogger: (input?: LoggerOptions, stream?: Destinat
|
|
|
38
52
|
send: (level: pino.Level, logEvent: pino.LogEvent) => void;
|
|
39
53
|
} | undefined;
|
|
40
54
|
} | undefined;
|
|
41
|
-
|
|
42
|
-
[key: string]:
|
|
43
|
-
} | undefined;
|
|
44
|
-
useOnlyCustomLevels?: boolean | undefined;
|
|
45
|
-
levelVal?: number | undefined;
|
|
46
|
-
onChild?: (<ChildOptions extends pino.ChildLoggerOptions>(child: pino.Logger<BaseLoggerOptions & ChildOptions>) => void) | undefined;
|
|
47
|
-
safe?: boolean | undefined;
|
|
48
|
-
serializers?: {
|
|
49
|
-
[key: string]: pino.SerializerFn;
|
|
50
|
-
} | undefined;
|
|
51
|
-
timestamp?: boolean | (() => string) | undefined;
|
|
52
|
-
mixin?: ((mergeObject: object, level: number) => object) | undefined;
|
|
53
|
-
mixinMergeStrategy?: ((mergeObject: object, mixinObject: object) => object) | undefined;
|
|
54
|
-
messageKey?: string | undefined;
|
|
55
|
-
errorKey?: string | undefined;
|
|
56
|
-
nestedKey?: string | undefined;
|
|
57
|
-
enabled?: boolean | undefined;
|
|
55
|
+
base?: {
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
} | null | undefined;
|
|
58
58
|
formatters?: {
|
|
59
59
|
level?: ((label: string, number: number) => object) | undefined;
|
|
60
60
|
bindings?: ((bindings: pino.Bindings) => object) | undefined;
|
package/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -10,6 +11,7 @@ var _exportNames = {
|
|
|
10
11
|
getLogger: true
|
|
11
12
|
};
|
|
12
13
|
exports.getLogger = exports.getLogLevel = exports.createPinoLogger = exports.configureLogger = void 0;
|
|
14
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
13
15
|
var _pino = require("pino");
|
|
14
16
|
Object.keys(_pino).forEach(function (key) {
|
|
15
17
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -36,10 +38,9 @@ const getLogLevel = (input, defaultLevel = "info") => {
|
|
|
36
38
|
exports.getLogLevel = getLogLevel;
|
|
37
39
|
let logger;
|
|
38
40
|
const createPinoLogger = (input, stream) => {
|
|
39
|
-
const options = {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
};
|
|
41
|
+
const options = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, input || {}), {}, {
|
|
42
|
+
level: getLogLevel(input === null || input === void 0 ? void 0 : input.level)
|
|
43
|
+
});
|
|
43
44
|
if (!stream) {
|
|
44
45
|
return (0, _pino.pino)(options);
|
|
45
46
|
}
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pino","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","levels","getLogLevel","input","defaultLevel","process","env","LOG_LEVEL","length","includes","logger","createPinoLogger","stream","options","level","pino","configureLogger","getLogger"],"sources":["index.ts"],"sourcesContent":["import {\n DestinationStream,\n LevelWithSilent,\n Logger,\n LoggerOptions as BaseLoggerOptions,\n pino\n} from \"pino\";\n\nexport * from \"pino\";\n\nexport interface RedactOptions {\n paths: string[];\n censor?: string | ((value: any, path: string[]) => any);\n remove?: boolean;\n}\n\nexport 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) => {\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":"
|
|
1
|
+
{"version":3,"names":["_pino","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","levels","getLogLevel","input","defaultLevel","process","env","LOG_LEVEL","length","includes","logger","createPinoLogger","stream","options","_objectSpread2","default","level","pino","configureLogger","getLogger"],"sources":["index.ts"],"sourcesContent":["import {\n DestinationStream,\n LevelWithSilent,\n Logger,\n LoggerOptions as BaseLoggerOptions,\n pino\n} from \"pino\";\n\nexport * from \"pino\";\n\nexport interface RedactOptions {\n paths: string[];\n censor?: string | ((value: any, path: string[]) => any);\n remove?: boolean;\n}\n\nexport 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) => {\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":";;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAQAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AAYA,MAAMS,MAAyB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC;AAChG;AACA;AACA;AACO,MAAMC,WAAW,GAAGA,CAACC,KAAc,EAAEC,YAA6B,GAAG,MAAM,KAAa;EAC3FD,KAAK,GAAGA,KAAK,IAAIE,OAAO,CAACC,GAAG,CAACC,SAAS;EACtC,IAAI,CAACJ,KAAK,IAAIA,KAAK,CAACK,MAAM,KAAK,CAAC,EAAE;IAC9B,OAAOJ,YAAY;EACvB;EACA,OAAOH,MAAM,CAACQ,QAAQ,CAACN,KAAwB,CAAC,GAAGA,KAAK,GAAGC,YAAY;AAC3E,CAAC;AAACP,OAAA,CAAAK,WAAA,GAAAA,WAAA;AAEF,IAAIQ,MAAc;AAEX,MAAMC,gBAAgB,GAAGA,CAACR,KAAqB,EAAES,MAA0B,KAAK;EACnF,MAAMC,OAAO,OAAAC,cAAA,CAAAC,OAAA,MAAAD,cAAA,CAAAC,OAAA,MACLZ,KAAK,IAAI,CAAC,CAAC;IACfa,KAAK,EAAEd,WAAW,CAACC,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEa,KAAK;EAAC,EACnC;EACD,IAAI,CAACJ,MAAM,EAAE;IACT,OAAO,IAAAK,UAAI,EAACJ,OAAO,CAAC;EACxB;EACA,OAAO,IAAAI,UAAI,EAACJ,OAAO,EAAED,MAAM,CAAC;AAChC,CAAC;AAACf,OAAA,CAAAc,gBAAA,GAAAA,gBAAA;AAEK,MAAMO,eAAe,GAAGA,CAACL,OAAsB,EAAED,MAA0B,KAAW;EACzFF,MAAM,GAAGC,gBAAgB,CAACE,OAAO,EAAED,MAAM,CAAC;AAC9C,CAAC;AAACf,OAAA,CAAAqB,eAAA,GAAAA,eAAA;AAEK,MAAMC,SAAS,GAAGA,CAAA,KAAM;EAC3B,IAAI,CAACT,MAAM,EAAE;IACTA,MAAM,GAAGC,gBAAgB,CAAC,CAAC;EAC/B;EACA,OAAOD,MAAM;AACjB,CAAC;AAACb,OAAA,CAAAsB,SAAA,GAAAA,SAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/logger",
|
|
3
|
-
"version": "5.38.
|
|
3
|
+
"version": "5.38.6",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"@babel/core": "7.22.8",
|
|
20
20
|
"@babel/preset-env": "7.22.7",
|
|
21
21
|
"@babel/preset-typescript": "7.22.5",
|
|
22
|
-
"@webiny/cli": "5.38.
|
|
23
|
-
"@webiny/project-utils": "5.38.
|
|
22
|
+
"@webiny/cli": "5.38.6",
|
|
23
|
+
"@webiny/project-utils": "5.38.6",
|
|
24
24
|
"pino": "8.11.0",
|
|
25
25
|
"rimraf": "3.0.2",
|
|
26
26
|
"ttypescript": "1.5.15",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"build": "yarn webiny run build",
|
|
35
35
|
"watch": "yarn webiny run watch"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "65d8c4beef7ebcd3115c97eb1e23d93e8e357d55"
|
|
38
38
|
}
|