@townco/core 0.0.17 → 0.0.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/logger.d.ts +1 -0
- package/dist/logger.js +18 -2
- package/package.json +2 -2
package/dist/logger.d.ts
CHANGED
package/dist/logger.js
CHANGED
|
@@ -71,6 +71,7 @@ export class Logger {
|
|
|
71
71
|
logsDir;
|
|
72
72
|
writeQueue = [];
|
|
73
73
|
isWriting = false;
|
|
74
|
+
enableConsoleOutput;
|
|
74
75
|
constructor(service, minLevel = "debug") {
|
|
75
76
|
this.service = service;
|
|
76
77
|
this.minLevel = minLevel;
|
|
@@ -79,6 +80,11 @@ export class Logger {
|
|
|
79
80
|
process.env?.NODE_ENV === "production") {
|
|
80
81
|
this.minLevel = "info";
|
|
81
82
|
}
|
|
83
|
+
// Enable console output for HTTP mode or when explicitly requested
|
|
84
|
+
this.enableConsoleOutput =
|
|
85
|
+
(typeof process !== "undefined" &&
|
|
86
|
+
process.env?.TOWN_LOG_CONSOLE === "true") ||
|
|
87
|
+
false;
|
|
82
88
|
// Note: File logging setup is done lazily in log() method
|
|
83
89
|
// This allows loggers created before configureLogsDir() to still write to files
|
|
84
90
|
}
|
|
@@ -159,8 +165,18 @@ export class Logger {
|
|
|
159
165
|
// Silently fail
|
|
160
166
|
});
|
|
161
167
|
}
|
|
162
|
-
//
|
|
163
|
-
|
|
168
|
+
// Console output when enabled (for HTTP mode debugging)
|
|
169
|
+
if (isNode && this.enableConsoleOutput) {
|
|
170
|
+
const timestamp = entry.timestamp;
|
|
171
|
+
const levelStr = entry.level.toUpperCase().padEnd(5);
|
|
172
|
+
const serviceStr = `[${this.service}]`;
|
|
173
|
+
const metaStr = entry.metadata
|
|
174
|
+
? ` ${JSON.stringify(entry.metadata)}`
|
|
175
|
+
: "";
|
|
176
|
+
console.log(`${timestamp} ${levelStr} ${serviceStr} ${entry.message}${metaStr}`);
|
|
177
|
+
}
|
|
178
|
+
// Note: Logs are captured and displayed in UI for TUI mode
|
|
179
|
+
// Console output only enabled when TOWN_LOG_CONSOLE=true
|
|
164
180
|
}
|
|
165
181
|
trace(message, metadata) {
|
|
166
182
|
this.log("trace", message, metadata);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@townco/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.19",
|
|
5
5
|
"description": "core",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"typescript": "^5.9.3",
|
|
21
|
-
"@townco/tsconfig": "0.1.
|
|
21
|
+
"@townco/tsconfig": "0.1.38"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "tsc",
|