@rife/logger 0.0.6-beta.11 → 0.0.6-beta.13
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/dist/cjs/common.cjs +3 -3
- package/dist/cjs/env.cjs +3 -3
- package/dist/cjs/index.cjs +7 -9
- package/dist/cjs/pino/index.cjs +25 -8
- package/dist/cjs/pino/rotate.cjs +6 -6
- package/dist/cjs/pino/worker/pino-file.cjs +221 -128
- package/dist/cjs/pino/worker/pino-pretty.cjs +327 -420
- package/dist/cjs/pino/worker/pino-rotate.cjs +21 -20
- package/dist/cjs/pino/worker/pino-worker.cjs +296 -203
- package/dist/cjs/pino/worker/thread-stream.cjs +39 -37
- package/dist/cjs/pino/worker.cjs +116 -0
- package/dist/cjs/test.cjs +6 -2
- package/dist/cjs/trace.cjs +3 -3
- package/dist/cjs/worker/index.cjs +5 -0
- package/dist/esm/common.mjs +3 -4
- package/dist/esm/env.mjs +1 -2
- package/dist/esm/index.mjs +1 -2
- package/dist/esm/pino/index.mjs +29 -25
- package/dist/esm/pino/rotate.mjs +8 -18
- package/dist/esm/pino/worker/pino-file.cjs +221 -128
- package/dist/esm/pino/worker/pino-pretty.cjs +327 -420
- package/dist/esm/pino/worker/pino-rotate.cjs +21 -20
- package/dist/esm/pino/worker/pino-worker.cjs +296 -203
- package/dist/esm/pino/worker/thread-stream.cjs +39 -37
- package/dist/esm/pino/worker.mjs +74 -0
- package/dist/esm/rslib-runtime.mjs +19 -0
- package/dist/esm/test.mjs +8 -5
- package/dist/esm/trace.mjs +1 -2
- package/dist/esm/worker/index.mjs +1 -0
- package/dist/worker/pino-file.cjs +221 -128
- package/dist/worker/pino-pretty.cjs +327 -420
- package/dist/worker/pino-rotate.cjs +21 -20
- package/dist/worker/pino-worker.cjs +296 -203
- package/dist/worker/thread-stream.cjs +39 -37
- package/package.json +16 -8
- package/src/pino/index.ts +30 -3
- package/src/pino/worker.ts +82 -0
- package/src/test.ts +5 -2
- package/src/worker/index.ts +3 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __webpack_modules__ = {
|
|
2
|
-
"../../node_modules/.pnpm/real-require@0.2.0/node_modules/real-require/src/index.js"
|
|
3
|
+
"../../node_modules/.pnpm/real-require@0.2.0/node_modules/real-require/src/index.js" (module1) {
|
|
3
4
|
const realImport = new Function('modulePath', 'return import(modulePath)');
|
|
4
5
|
function realRequire(modulePath) {
|
|
5
6
|
if ('function' == typeof __non_webpack__require__) return __non_webpack__require__(modulePath);
|
|
@@ -10,7 +11,7 @@ var __webpack_modules__ = {
|
|
|
10
11
|
realRequire
|
|
11
12
|
};
|
|
12
13
|
},
|
|
13
|
-
"../../node_modules/.pnpm/thread-stream@
|
|
14
|
+
"../../node_modules/.pnpm/thread-stream@4.0.0/node_modules/thread-stream/lib/indexes.js" (module1) {
|
|
14
15
|
"use strict";
|
|
15
16
|
const WRITE_INDEX = 4;
|
|
16
17
|
const READ_INDEX = 8;
|
|
@@ -19,45 +20,41 @@ var __webpack_modules__ = {
|
|
|
19
20
|
READ_INDEX
|
|
20
21
|
};
|
|
21
22
|
},
|
|
22
|
-
"../../node_modules/.pnpm/thread-stream@
|
|
23
|
+
"../../node_modules/.pnpm/thread-stream@4.0.0/node_modules/thread-stream/lib/wait.js" (module1) {
|
|
23
24
|
"use strict";
|
|
24
|
-
const
|
|
25
|
+
const WAIT_MS = 10000;
|
|
25
26
|
function wait(state, index, expected, timeout, done) {
|
|
26
|
-
const max = Date.now() + timeout;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (current === prior) check(backoff >= MAX_TIMEOUT ? MAX_TIMEOUT : 2 * backoff);
|
|
36
|
-
else current === expected ? done(null, 'ok') : done(null, 'not-equal');
|
|
37
|
-
}, backoff);
|
|
27
|
+
const max = timeout === 1 / 0 ? 1 / 0 : Date.now() + timeout;
|
|
28
|
+
const check = ()=>{
|
|
29
|
+
const current = Atomics.load(state, index);
|
|
30
|
+
if (current === expected) return void done(null, 'ok');
|
|
31
|
+
if (max !== 1 / 0 && Date.now() > max) return void done(null, 'timed-out');
|
|
32
|
+
const remaining = max === 1 / 0 ? WAIT_MS : Math.min(WAIT_MS, Math.max(1, max - Date.now()));
|
|
33
|
+
const result = Atomics.waitAsync(state, index, current, remaining);
|
|
34
|
+
if (result.async) result.value.then(check);
|
|
35
|
+
else setImmediate(check);
|
|
38
36
|
};
|
|
39
|
-
check(
|
|
37
|
+
check();
|
|
40
38
|
}
|
|
41
39
|
function waitDiff(state, index, expected, timeout, done) {
|
|
42
|
-
const max = Date.now() + timeout;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (Date.now() > max) done(null, 'timed-out');
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, backoff);
|
|
40
|
+
const max = timeout === 1 / 0 ? 1 / 0 : Date.now() + timeout;
|
|
41
|
+
const check = ()=>{
|
|
42
|
+
const current = Atomics.load(state, index);
|
|
43
|
+
if (current !== expected) return void done(null, 'ok');
|
|
44
|
+
if (max !== 1 / 0 && Date.now() > max) return void done(null, 'timed-out');
|
|
45
|
+
const remaining = max === 1 / 0 ? WAIT_MS : Math.min(WAIT_MS, Math.max(1, max - Date.now()));
|
|
46
|
+
const result = Atomics.waitAsync(state, index, expected, remaining);
|
|
47
|
+
if (result.async) result.value.then(check);
|
|
48
|
+
else setImmediate(check);
|
|
52
49
|
};
|
|
53
|
-
check(
|
|
50
|
+
check();
|
|
54
51
|
}
|
|
55
52
|
module1.exports = {
|
|
56
53
|
wait,
|
|
57
54
|
waitDiff
|
|
58
55
|
};
|
|
59
56
|
},
|
|
60
|
-
worker_threads
|
|
57
|
+
worker_threads (module1) {
|
|
61
58
|
"use strict";
|
|
62
59
|
module1.exports = require("worker_threads");
|
|
63
60
|
}
|
|
@@ -77,21 +74,17 @@ var __webpack_exports__ = {};
|
|
|
77
74
|
"use strict";
|
|
78
75
|
const { realImport, realRequire } = __webpack_require__("../../node_modules/.pnpm/real-require@0.2.0/node_modules/real-require/src/index.js");
|
|
79
76
|
const { workerData, parentPort } = __webpack_require__("worker_threads");
|
|
80
|
-
const { WRITE_INDEX, READ_INDEX } = __webpack_require__("../../node_modules/.pnpm/thread-stream@
|
|
81
|
-
const { waitDiff } = __webpack_require__("../../node_modules/.pnpm/thread-stream@
|
|
77
|
+
const { WRITE_INDEX, READ_INDEX } = __webpack_require__("../../node_modules/.pnpm/thread-stream@4.0.0/node_modules/thread-stream/lib/indexes.js");
|
|
78
|
+
const { waitDiff } = __webpack_require__("../../node_modules/.pnpm/thread-stream@4.0.0/node_modules/thread-stream/lib/wait.js");
|
|
82
79
|
const { dataBuf, filename, stateBuf } = workerData;
|
|
83
80
|
let destination;
|
|
84
81
|
const state = new Int32Array(stateBuf);
|
|
85
82
|
const data = Buffer.from(dataBuf);
|
|
83
|
+
const keepAlive = setInterval(()=>{}, 3600000);
|
|
86
84
|
async function start() {
|
|
87
85
|
let worker;
|
|
88
86
|
try {
|
|
89
|
-
|
|
90
|
-
if (process[Symbol.for('ts-node.register.instance')]) {
|
|
91
|
-
if (process.env.TS_NODE_DEV) realRequire('ts-node-dev');
|
|
92
|
-
} else realRequire('ts-node/register');
|
|
93
|
-
worker = realRequire(decodeURIComponent(filename.replace('win32' === process.platform ? 'file:///' : 'file://', '')));
|
|
94
|
-
} else worker = await realImport(filename);
|
|
87
|
+
worker = await realImport(filename);
|
|
95
88
|
} catch (error) {
|
|
96
89
|
if (('ENOTDIR' === error.code || 'ERR_MODULE_NOT_FOUND' === error.code) && filename.startsWith('file://')) worker = realRequire(decodeURIComponent(filename.replace('file://', '')));
|
|
97
90
|
else if (void 0 === error.code || 'ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING' === error.code) try {
|
|
@@ -99,6 +92,14 @@ var __webpack_exports__ = {};
|
|
|
99
92
|
} catch {
|
|
100
93
|
throw error;
|
|
101
94
|
}
|
|
95
|
+
else if (filename.endsWith('.ts') || filename.endsWith('.cts')) try {
|
|
96
|
+
if (process[Symbol.for('ts-node.register.instance')]) {
|
|
97
|
+
if (process.env.TS_NODE_DEV) realRequire('ts-node-dev');
|
|
98
|
+
} else realRequire('ts-node/register');
|
|
99
|
+
worker = realRequire(decodeURIComponent(filename.replace('win32' === process.platform ? 'file:///' : 'file://', '')));
|
|
100
|
+
} catch {
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
102
103
|
else throw error;
|
|
103
104
|
}
|
|
104
105
|
if ('object' == typeof worker) worker = worker.default;
|
|
@@ -118,6 +119,7 @@ var __webpack_exports__ = {};
|
|
|
118
119
|
const end = Atomics.load(state, WRITE_INDEX);
|
|
119
120
|
Atomics.store(state, READ_INDEX, end);
|
|
120
121
|
Atomics.notify(state, READ_INDEX);
|
|
122
|
+
clearInterval(keepAlive);
|
|
121
123
|
setImmediate(()=>{
|
|
122
124
|
process.exit(0);
|
|
123
125
|
});
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
createLogger: ()=>createLogger
|
|
37
|
+
});
|
|
38
|
+
const external_pino_namespaceObject = require("pino");
|
|
39
|
+
var external_pino_default = /*#__PURE__*/ __webpack_require__.n(external_pino_namespaceObject);
|
|
40
|
+
const external_path_namespaceObject = require("path");
|
|
41
|
+
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
42
|
+
const external_trace_cjs_namespaceObject = require("../trace.cjs");
|
|
43
|
+
function getPinoConfig() {
|
|
44
|
+
const targets = [];
|
|
45
|
+
if ('production' === process.env.NODE_ENV) ;
|
|
46
|
+
else {
|
|
47
|
+
const rotate = `./rotate${external_path_default().extname(__filename)}`;
|
|
48
|
+
targets.push({
|
|
49
|
+
level: 'debug',
|
|
50
|
+
target: rotate,
|
|
51
|
+
options: {
|
|
52
|
+
path: './logs/'
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
targets.push({
|
|
56
|
+
level: 'debug',
|
|
57
|
+
target: 'pino-pretty',
|
|
58
|
+
options: {
|
|
59
|
+
ignore: 'pid',
|
|
60
|
+
messageKey: 'message'
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
const config = {
|
|
65
|
+
transport: {
|
|
66
|
+
targets
|
|
67
|
+
},
|
|
68
|
+
mixin (data) {
|
|
69
|
+
const traceId = data?.traceId;
|
|
70
|
+
delete data.traceId;
|
|
71
|
+
delete data.level;
|
|
72
|
+
delete data.time;
|
|
73
|
+
delete data.pid;
|
|
74
|
+
delete data.name;
|
|
75
|
+
delete data.hostname;
|
|
76
|
+
if (!traceId) return {
|
|
77
|
+
traceId: (0, external_trace_cjs_namespaceObject.getTraceId)()
|
|
78
|
+
};
|
|
79
|
+
return {
|
|
80
|
+
traceId
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
browser: {
|
|
84
|
+
write: (o)=>{
|
|
85
|
+
const { name, time, level, ...rest } = o;
|
|
86
|
+
if (name) rest.message = rest.message ? `[${name}] ${rest.message}` : `[${name}]`;
|
|
87
|
+
if (!rest.traceId) rest.traceId = (0, external_trace_cjs_namespaceObject.getTraceId)();
|
|
88
|
+
if (level >= 50) console.error(rest);
|
|
89
|
+
else if (level >= 40) console.warn(rest);
|
|
90
|
+
else console.log(rest);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
return config;
|
|
95
|
+
}
|
|
96
|
+
function createLogger() {
|
|
97
|
+
const logger = external_pino_default()({
|
|
98
|
+
base: {
|
|
99
|
+
pid: process.pid
|
|
100
|
+
},
|
|
101
|
+
messageKey: 'message',
|
|
102
|
+
errorKey: 'error',
|
|
103
|
+
timestamp: external_pino_default().stdTimeFunctions.epochTime,
|
|
104
|
+
...getPinoConfig()
|
|
105
|
+
});
|
|
106
|
+
return {
|
|
107
|
+
logger
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
exports.createLogger = __webpack_exports__.createLogger;
|
|
111
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
112
|
+
"createLogger"
|
|
113
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
114
|
+
Object.defineProperty(exports, '__esModule', {
|
|
115
|
+
value: true
|
|
116
|
+
});
|
package/dist/cjs/test.cjs
CHANGED
|
@@ -29,8 +29,12 @@ log.info({
|
|
|
29
29
|
c: 1,
|
|
30
30
|
name: '========'
|
|
31
31
|
}, 'name overide');
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
(0, external_trace_cjs_namespaceObject.runInTrace)({
|
|
33
|
+
traceId: (0, external_trace_cjs_namespaceObject.genTraceId)()
|
|
34
|
+
}, ()=>{
|
|
35
|
+
log.info(1);
|
|
36
|
+
});
|
|
37
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
34
38
|
Object.defineProperty(exports, '__esModule', {
|
|
35
39
|
value: true
|
|
36
40
|
});
|
package/dist/cjs/trace.cjs
CHANGED
|
@@ -13,7 +13,7 @@ var __webpack_require__ = {};
|
|
|
13
13
|
})();
|
|
14
14
|
(()=>{
|
|
15
15
|
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if (
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
17
|
value: 'Module'
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -42,11 +42,11 @@ function getTraceId() {
|
|
|
42
42
|
exports.genTraceId = __webpack_exports__.genTraceId;
|
|
43
43
|
exports.getTraceId = __webpack_exports__.getTraceId;
|
|
44
44
|
exports.runInTrace = __webpack_exports__.runInTrace;
|
|
45
|
-
for(var
|
|
45
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
46
46
|
"genTraceId",
|
|
47
47
|
"getTraceId",
|
|
48
48
|
"runInTrace"
|
|
49
|
-
].indexOf(
|
|
49
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
50
50
|
Object.defineProperty(exports, '__esModule', {
|
|
51
51
|
value: true
|
|
52
52
|
});
|
package/dist/esm/common.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
import { fileURLToPath as __webpack_fileURLToPath__ } from "node:url";
|
|
1
|
+
import "node:module";
|
|
4
2
|
import path from "path";
|
|
5
|
-
|
|
3
|
+
import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
4
|
+
var common_filename = __rspack_fileURLToPath(import.meta.url);
|
|
6
5
|
const isEsm = '.mjs' === path.extname(common_filename);
|
|
7
6
|
const isCjs = !isEsm;
|
|
8
7
|
export { isCjs, isEsm };
|
package/dist/esm/env.mjs
CHANGED
package/dist/esm/index.mjs
CHANGED
package/dist/esm/pino/index.mjs
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
import { fileURLToPath as __webpack_fileURLToPath__ } from "node:url";
|
|
4
|
-
import { dirname as __webpack_dirname__ } from "node:path";
|
|
5
|
-
import * as __WEBPACK_EXTERNAL_MODULE_pino_std_serializers_719fa64c__ from "pino-std-serializers";
|
|
1
|
+
import "node:module";
|
|
6
2
|
import path from "path";
|
|
7
3
|
import pino from "pino";
|
|
8
4
|
import { genTraceId, getTraceId, runInTrace } from "../trace.mjs";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
import { __webpack_require__ } from "../rslib-runtime.mjs";
|
|
6
|
+
import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
7
|
+
import { dirname as __rspack_dirname } from "node:path";
|
|
8
|
+
import * as __rspack_external_pino_std_serializers_719fa64c from "pino-std-serializers";
|
|
9
|
+
__webpack_require__.add({
|
|
10
|
+
"pino-std-serializers" (module) {
|
|
11
|
+
module.exports = __rspack_external_pino_std_serializers_719fa64c;
|
|
12
12
|
}
|
|
13
|
-
};
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
17
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
18
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
19
|
-
exports: {}
|
|
20
|
-
};
|
|
21
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
22
|
-
return module.exports;
|
|
23
|
-
}
|
|
24
|
-
var pino_filename = __webpack_fileURLToPath__(import.meta.url);
|
|
25
|
-
var pino_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
|
|
13
|
+
});
|
|
14
|
+
var pino_filename = __rspack_fileURLToPath(import.meta.url);
|
|
15
|
+
var pino_dirname = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
|
|
26
16
|
function getPinoConfig() {
|
|
27
17
|
const targets = [];
|
|
28
18
|
const rotate = `./rotate${path.extname(pino_filename)}`;
|
|
@@ -33,7 +23,7 @@ function getPinoConfig() {
|
|
|
33
23
|
path: './logs/'
|
|
34
24
|
}
|
|
35
25
|
});
|
|
36
|
-
if (
|
|
26
|
+
if ("u" > typeof __isNodeSingleFileBundle || "u" > typeof __isVite || global?.__remix_devServerHooks || 'development' !== process.env.NODE_ENV) globalThis.__bundlerPathsOverrides = {
|
|
37
27
|
'pino-pretty': path.join(pino_dirname, './worker/pino-pretty.cjs'),
|
|
38
28
|
'pino-worker': path.join(pino_dirname, './worker/pino-worker.cjs'),
|
|
39
29
|
[rotate]: path.join(pino_dirname, './worker/pino-rotate.cjs'),
|
|
@@ -54,15 +44,29 @@ function getPinoConfig() {
|
|
|
54
44
|
targets
|
|
55
45
|
},
|
|
56
46
|
mixin (data) {
|
|
47
|
+
const traceId = data?.traceId;
|
|
48
|
+
delete data.traceId;
|
|
57
49
|
delete data.level;
|
|
58
50
|
delete data.time;
|
|
59
51
|
delete data.pid;
|
|
60
52
|
delete data.name;
|
|
61
53
|
delete data.hostname;
|
|
62
|
-
if (!
|
|
54
|
+
if (!traceId) return {
|
|
63
55
|
traceId: getTraceId()
|
|
64
56
|
};
|
|
65
|
-
return {
|
|
57
|
+
return {
|
|
58
|
+
traceId
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
browser: {
|
|
62
|
+
write: (o)=>{
|
|
63
|
+
const { name, time, level, ...rest } = o;
|
|
64
|
+
if (name) rest.message = rest.message ? `[${name}] ${rest.message}` : `[${name}]`;
|
|
65
|
+
if (!rest.traceId) rest.traceId = getTraceId();
|
|
66
|
+
if (level >= 50) console.error(rest);
|
|
67
|
+
else if (level >= 40) console.warn(rest);
|
|
68
|
+
else console.log(rest);
|
|
69
|
+
}
|
|
66
70
|
}
|
|
67
71
|
};
|
|
68
72
|
return config;
|
|
@@ -113,4 +117,4 @@ function useExpress(logger, format) {
|
|
|
113
117
|
}, next);
|
|
114
118
|
};
|
|
115
119
|
}
|
|
116
|
-
export { createLogger, useExpress };
|
|
120
|
+
export { createLogger, pino, useExpress };
|
package/dist/esm/pino/rotate.mjs
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import * as
|
|
4
|
-
|
|
5
|
-
"rotating-file-stream"
|
|
6
|
-
module.exports =
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { __webpack_require__ } from "../rslib-runtime.mjs";
|
|
3
|
+
import * as __rspack_external_rotating_file_stream_66c5ea63 from "rotating-file-stream";
|
|
4
|
+
__webpack_require__.add({
|
|
5
|
+
"rotating-file-stream" (module) {
|
|
6
|
+
module.exports = __rspack_external_rotating_file_stream_66c5ea63;
|
|
7
7
|
}
|
|
8
|
-
};
|
|
9
|
-
var __webpack_module_cache__ = {};
|
|
10
|
-
function __webpack_require__(moduleId) {
|
|
11
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
12
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
13
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
14
|
-
exports: {}
|
|
15
|
-
};
|
|
16
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
17
|
-
return module.exports;
|
|
18
|
-
}
|
|
8
|
+
});
|
|
19
9
|
const generator = (time, index)=>{
|
|
20
10
|
if (!time) return 'server.log';
|
|
21
11
|
time = new Date(time);
|
|
@@ -37,4 +27,4 @@ const rotate = (options)=>{
|
|
|
37
27
|
path
|
|
38
28
|
});
|
|
39
29
|
};
|
|
40
|
-
export
|
|
30
|
+
export default rotate;
|