@adhdev/daemon-core 0.8.7 → 0.8.9
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/index.d.ts +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -1
- package/dist/logging/logger.d.ts +2 -0
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +1 -1
- package/src/index.ts +9 -1
- package/src/logging/logger.ts +8 -0
package/dist/logging/logger.d.ts
CHANGED
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
20
20
|
export declare function setLogLevel(level: LogLevel): void;
|
|
21
21
|
export declare function getLogLevel(): LogLevel;
|
|
22
|
+
export declare function getDaemonLogDir(): string;
|
|
23
|
+
export declare function getCurrentDaemonLogPath(date?: Date): string;
|
|
22
24
|
export interface LogEntry {
|
|
23
25
|
ts: number;
|
|
24
26
|
level: LogLevel;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -102,7 +102,15 @@ export type { ManagedStatus } from './status/normalize.js';
|
|
|
102
102
|
export type { StatusSnapshotOptions, StatusSnapshot } from './status/snapshot.js';
|
|
103
103
|
|
|
104
104
|
// ── Logger ──
|
|
105
|
-
export {
|
|
105
|
+
export {
|
|
106
|
+
LOG,
|
|
107
|
+
installGlobalInterceptor,
|
|
108
|
+
setLogLevel,
|
|
109
|
+
getLogLevel,
|
|
110
|
+
getRecentLogs,
|
|
111
|
+
getDaemonLogDir,
|
|
112
|
+
getCurrentDaemonLogPath,
|
|
113
|
+
} from './logging/logger.js';
|
|
106
114
|
export type { ScopedLogger, LogLevel, LogEntry } from './logging/logger.js';
|
|
107
115
|
export { logCommand, getRecentCommands } from './logging/command-log.js';
|
|
108
116
|
|
package/src/logging/logger.ts
CHANGED
|
@@ -54,6 +54,14 @@ function getDateStr(): string {
|
|
|
54
54
|
let currentDate = getDateStr();
|
|
55
55
|
let currentLogFile = path.join(LOG_DIR, `daemon-${currentDate}.log`);
|
|
56
56
|
|
|
57
|
+
export function getDaemonLogDir(): string {
|
|
58
|
+
return LOG_DIR;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function getCurrentDaemonLogPath(date = new Date()): string {
|
|
62
|
+
return path.join(LOG_DIR, `daemon-${date.toISOString().slice(0, 10)}.log`);
|
|
63
|
+
}
|
|
64
|
+
|
|
57
65
|
/** date change detect + old file cleanup */
|
|
58
66
|
function checkDateRotation(): void {
|
|
59
67
|
const today = getDateStr();
|