create-nara 1.0.43 → 1.0.44
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.
Potentially problematic release.
This version of create-nara might be problematic. Click here for more details.
package/package.json
CHANGED
|
@@ -16,6 +16,18 @@ const LOG_LEVELS: Record<LogLevel, number> = {
|
|
|
16
16
|
fatal: 60,
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
// ANSI color codes for log levels
|
|
20
|
+
const COLORS = {
|
|
21
|
+
reset: '\x1b[0m',
|
|
22
|
+
trace: '\x1b[90m', // Gray
|
|
23
|
+
debug: '\x1b[36m', // Cyan
|
|
24
|
+
info: '\x1b[32m', // Green
|
|
25
|
+
warn: '\x1b[33m', // Yellow
|
|
26
|
+
error: '\x1b[31m', // Red
|
|
27
|
+
fatal: '\x1b[35m', // Magenta
|
|
28
|
+
timestamp: '\x1b[90m', // Gray
|
|
29
|
+
};
|
|
30
|
+
|
|
19
31
|
/**
|
|
20
32
|
* Get current log level from environment
|
|
21
33
|
*/
|
|
@@ -38,11 +50,12 @@ function shouldLog(level: LogLevel): boolean {
|
|
|
38
50
|
function formatLog(level: LogLevel, message: string, data?: Record<string, any>): string {
|
|
39
51
|
const timestamp = new Date().toISOString();
|
|
40
52
|
const levelUpper = level.toUpperCase().padEnd(5);
|
|
53
|
+
const color = COLORS[level];
|
|
41
54
|
|
|
42
55
|
if (data && Object.keys(data).length > 0) {
|
|
43
|
-
return
|
|
56
|
+
return `${COLORS.timestamp}[${timestamp}]${COLORS.reset} ${color}${levelUpper}${COLORS.reset} ${message} ${JSON.stringify(data)}`;
|
|
44
57
|
}
|
|
45
|
-
return
|
|
58
|
+
return `${COLORS.timestamp}[${timestamp}]${COLORS.reset} ${color}${levelUpper}${COLORS.reset} ${message}`;
|
|
46
59
|
}
|
|
47
60
|
|
|
48
61
|
/**
|
|
@@ -149,4 +149,9 @@ export function registerRoutes(app: NaraApp) {
|
|
|
149
149
|
const filePath = req.path.replace('/uploads/', '');
|
|
150
150
|
res.sendFile(`uploads/${filePath}`);
|
|
151
151
|
});
|
|
152
|
+
|
|
153
|
+
// Public folder static files
|
|
154
|
+
app.get('/nara.png', (req, res) => {
|
|
155
|
+
res.sendFile('public/nara.png');
|
|
156
|
+
});
|
|
152
157
|
}
|