@rife/logger 0.0.6-beta.17 → 0.0.6-beta.19
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/pino/worker/pino-file.cjs +127 -91
- package/dist/cjs/pino/worker/pino-pretty.cjs +497 -265
- package/dist/cjs/pino/worker/pino-rotate.cjs +7 -5
- package/dist/cjs/pino/worker/pino-worker.cjs +133 -97
- package/dist/cjs/pino/worker/thread-stream.cjs +6 -6
- package/dist/esm/pino/index.mjs +3 -8
- package/dist/esm/pino/rotate.mjs +3 -8
- package/dist/esm/pino/worker/pino-file.cjs +127 -91
- package/dist/esm/pino/worker/pino-pretty.cjs +497 -265
- package/dist/esm/pino/worker/pino-rotate.cjs +7 -5
- package/dist/esm/pino/worker/pino-worker.cjs +133 -97
- package/dist/esm/pino/worker/thread-stream.cjs +6 -6
- package/dist/worker/pino-file.cjs +127 -91
- package/dist/worker/pino-pretty.cjs +497 -265
- package/dist/worker/pino-rotate.cjs +7 -5
- package/dist/worker/pino-worker.cjs +133 -97
- package/dist/worker/thread-stream.cjs +6 -6
- package/package.json +6 -6
- package/src/pino/index.ts +3 -3
- package/tsconfig.json +2 -1
- package/dist/esm/rslib-runtime.mjs +0 -19
|
@@ -26,12 +26,12 @@ var __webpack_modules__ = {
|
|
|
26
26
|
"use strict";
|
|
27
27
|
const WAIT_MS = 10000;
|
|
28
28
|
function wait(state, index, expected, timeout, done) {
|
|
29
|
-
const max =
|
|
29
|
+
const max = 1 / 0 === timeout ? 1 / 0 : Date.now() + timeout;
|
|
30
30
|
const check = ()=>{
|
|
31
31
|
const current = Atomics.load(state, index);
|
|
32
32
|
if (current === expected) return void done(null, 'ok');
|
|
33
|
-
if (
|
|
34
|
-
const remaining =
|
|
33
|
+
if (1 / 0 !== max && Date.now() > max) return void done(null, 'timed-out');
|
|
34
|
+
const remaining = 1 / 0 === max ? WAIT_MS : Math.min(WAIT_MS, Math.max(1, max - Date.now()));
|
|
35
35
|
const result = Atomics.waitAsync(state, index, current, remaining);
|
|
36
36
|
if (result.async) result.value.then(check);
|
|
37
37
|
else setImmediate(check);
|
|
@@ -39,12 +39,12 @@ var __webpack_modules__ = {
|
|
|
39
39
|
check();
|
|
40
40
|
}
|
|
41
41
|
function waitDiff(state, index, expected, timeout, done) {
|
|
42
|
-
const max =
|
|
42
|
+
const max = 1 / 0 === timeout ? 1 / 0 : Date.now() + timeout;
|
|
43
43
|
const check = ()=>{
|
|
44
44
|
const current = Atomics.load(state, index);
|
|
45
45
|
if (current !== expected) return void done(null, 'ok');
|
|
46
|
-
if (
|
|
47
|
-
const remaining =
|
|
46
|
+
if (1 / 0 !== max && Date.now() > max) return void done(null, 'timed-out');
|
|
47
|
+
const remaining = 1 / 0 === max ? WAIT_MS : Math.min(WAIT_MS, Math.max(1, max - Date.now()));
|
|
48
48
|
const result = Atomics.waitAsync(state, index, expected, remaining);
|
|
49
49
|
if (result.async) result.value.then((res)=>{
|
|
50
50
|
if ('ok' === res) return void done(null, 'ok');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rife/logger",
|
|
3
|
-
"version": "0.0.6-beta.
|
|
3
|
+
"version": "0.0.6-beta.19",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
"tsconfig.json"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"pino": "^10.
|
|
41
|
-
"pino-pretty": "^13.
|
|
40
|
+
"pino": "^10.4.0",
|
|
41
|
+
"pino-pretty": "^13.2.0",
|
|
42
42
|
"pino-std-serializers": "^7.1.0",
|
|
43
43
|
"rotating-file-stream": "^3.2.9"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"
|
|
47
|
-
"@rife/
|
|
48
|
-
"
|
|
46
|
+
"@rife/cli": "0.0.6-beta.26",
|
|
47
|
+
"@rife/plugin-rstack": "0.0.1-beta.26",
|
|
48
|
+
"thread-stream": "^4.0.0"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"dev": "rife dev",
|
package/src/pino/index.ts
CHANGED
|
@@ -2,8 +2,6 @@ import path from 'path';
|
|
|
2
2
|
import pino from 'pino';
|
|
3
3
|
|
|
4
4
|
export { pino };
|
|
5
|
-
// 避免报错 "This is likely not portable. A type annotation is necessary."
|
|
6
|
-
export type { Logger } from 'pino';
|
|
7
5
|
|
|
8
6
|
import { genTraceId, getTraceId, runInTrace } from '../trace';
|
|
9
7
|
|
|
@@ -108,8 +106,10 @@ function getPinoConfig() {
|
|
|
108
106
|
return config;
|
|
109
107
|
}
|
|
110
108
|
|
|
109
|
+
export type Logger = pino.Logger<never, boolean>;
|
|
110
|
+
|
|
111
111
|
export function createLogger() {
|
|
112
|
-
const logger = pino({
|
|
112
|
+
const logger: Logger = pino({
|
|
113
113
|
// https://github.com/pinojs/pino/blob/main/docs/api.md#opt-serializers
|
|
114
114
|
base: { pid: process.pid },
|
|
115
115
|
messageKey: 'message',
|
package/tsconfig.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
var __webpack_modules__ = {};
|
|
3
|
-
var __webpack_module_cache__ = {};
|
|
4
|
-
function __webpack_require__(moduleId) {
|
|
5
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
6
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
7
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
8
|
-
exports: {}
|
|
9
|
-
};
|
|
10
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
11
|
-
return module.exports;
|
|
12
|
-
}
|
|
13
|
-
__webpack_require__.m = __webpack_modules__;
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.add = function(modules) {
|
|
16
|
-
Object.assign(__webpack_require__.m, modules);
|
|
17
|
-
};
|
|
18
|
-
})();
|
|
19
|
-
export { __webpack_require__ };
|