lhisp-logger 2.2.1 → 2.2.3
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/package.json +1 -1
- package/src/lhisp-logger.d.ts +1 -0
- package/src/lhisp-logger.js +1 -20
package/package.json
CHANGED
package/src/lhisp-logger.d.ts
CHANGED
package/src/lhisp-logger.js
CHANGED
|
@@ -42,20 +42,6 @@ function lhLogger(options = {}) {
|
|
|
42
42
|
error: (error) => ((0, isAxiosError_1.isAxiosError)(error) ? (0, axiosErrorSerializer_1.axiosErrorSerializer)(error) : pino_1.default.stdSerializers.err(error)),
|
|
43
43
|
axiosError: axiosErrorSerializer_1.axiosErrorSerializer,
|
|
44
44
|
},
|
|
45
|
-
hooks: {
|
|
46
|
-
logMethod(args, method) {
|
|
47
|
-
const first = args[0];
|
|
48
|
-
if (first && typeof first === "object" && !Array.isArray(first)) {
|
|
49
|
-
const dbname = first.dbname;
|
|
50
|
-
if (dbname) {
|
|
51
|
-
const existingLabels = first.labels;
|
|
52
|
-
args[0] = Object.assign(Object.assign({}, first), { labels: Object.assign(Object.assign({}, (existingLabels || {})), { dbname }) });
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
// forward to original method
|
|
56
|
-
method.apply(this, args);
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
45
|
};
|
|
60
46
|
const targets = [];
|
|
61
47
|
if (pretty) {
|
|
@@ -72,17 +58,12 @@ function lhLogger(options = {}) {
|
|
|
72
58
|
}
|
|
73
59
|
if (lokiEnabled) {
|
|
74
60
|
const appName = getHostPackageName() || name || process.env.npm_package_name || "lhisp-app";
|
|
75
|
-
const labels = {
|
|
76
|
-
app: appName,
|
|
77
|
-
env: process.env.NODE_ENV || "development",
|
|
78
|
-
servidor: process.env.SERVERTAG || getEtcHostname() || os_1.default.hostname(),
|
|
79
|
-
};
|
|
80
61
|
targets.push({
|
|
81
62
|
level,
|
|
82
63
|
target: "pino-loki",
|
|
83
64
|
options: {
|
|
84
65
|
host: lokiUrl,
|
|
85
|
-
labels,
|
|
66
|
+
labels: Object.assign({ app: appName, env: process.env.NODE_ENV || "development", servidor: process.env.SERVERTAG || getEtcHostname() || os_1.default.hostname() }, options.labels),
|
|
86
67
|
interval: 5,
|
|
87
68
|
batching: true,
|
|
88
69
|
},
|