@songsid/agend 2.1.0-beta.11 → 2.1.0-beta.12
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/logger.d.ts +6 -0
- package/dist/logger.js +23 -7
- package/dist/logger.js.map +1 -1
- package/package.json +1 -1
package/dist/logger.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import pino from "pino";
|
|
2
|
+
export declare function getStdoutPrettyOptions(destinationIsFile?: boolean): {
|
|
3
|
+
destination: number;
|
|
4
|
+
colorize: boolean;
|
|
5
|
+
translateTime: string;
|
|
6
|
+
ignore: string;
|
|
7
|
+
};
|
|
2
8
|
/**
|
|
3
9
|
* Rotate a log file via copytruncate: foo.log → foo.log.1 → foo.log.2 → foo.log.3 (deleted).
|
|
4
10
|
*
|
package/dist/logger.js
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
import pino from "pino";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { mkdirSync, statSync, existsSync, unlinkSync, renameSync, copyFileSync, truncateSync } from "node:fs";
|
|
3
|
+
import { mkdirSync, statSync, fstatSync, existsSync, unlinkSync, renameSync, copyFileSync, truncateSync } from "node:fs";
|
|
4
4
|
import { getAgendHome } from "./paths.js";
|
|
5
5
|
const DATA_DIR = getAgendHome();
|
|
6
6
|
const LOG_FILE = join(DATA_DIR, "daemon.log");
|
|
7
7
|
const MAX_LOG_SIZE = 10 * 1024 * 1024; // 10 MB
|
|
8
8
|
const ROTATE_MAX_FILES = 3;
|
|
9
|
+
/**
|
|
10
|
+
* fleet.log is the service manager's stdout destination, not pino's direct
|
|
11
|
+
* file transport (which writes daemon.log). Detect that regular-file stdout so
|
|
12
|
+
* it receives a date; terminals and pipes keep the compact console format.
|
|
13
|
+
*/
|
|
14
|
+
function stdoutIsRegularFile() {
|
|
15
|
+
try {
|
|
16
|
+
return fstatSync(1).isFile();
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function getStdoutPrettyOptions(destinationIsFile = stdoutIsRegularFile()) {
|
|
23
|
+
return {
|
|
24
|
+
destination: 1,
|
|
25
|
+
colorize: !destinationIsFile,
|
|
26
|
+
translateTime: destinationIsFile ? "SYS:yyyy-mm-dd HH:MM:ss" : "SYS:HH:MM:ss",
|
|
27
|
+
ignore: "pid,hostname",
|
|
28
|
+
};
|
|
29
|
+
}
|
|
9
30
|
/**
|
|
10
31
|
* Rotate a log file via copytruncate: foo.log → foo.log.1 → foo.log.2 → foo.log.3 (deleted).
|
|
11
32
|
*
|
|
@@ -55,12 +76,7 @@ export function createLogger(level = "info") {
|
|
|
55
76
|
targets: [
|
|
56
77
|
{
|
|
57
78
|
target: "pino-pretty",
|
|
58
|
-
options:
|
|
59
|
-
destination: 1,
|
|
60
|
-
colorize: true,
|
|
61
|
-
translateTime: "SYS:HH:MM:ss",
|
|
62
|
-
ignore: "pid,hostname",
|
|
63
|
-
},
|
|
79
|
+
options: getStdoutPrettyOptions(),
|
|
64
80
|
// The root/child logger level performs per-component filtering. Keep
|
|
65
81
|
// transports permissive so a debug-level daemon child is not filtered
|
|
66
82
|
// by an info-level fleet root before it reaches the shared worker.
|
package/dist/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,IA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