forked from inattendu/dashreader
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogger.ts
More file actions
37 lines (32 loc) · 731 Bytes
/
Copy pathlogger.ts
File metadata and controls
37 lines (32 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* Simple conditional logger for DashReader
*
* In production: only errors are logged
* In debug mode: all logs are shown
*/
const DEBUG = false; // Set to true for development debugging
export class Logger {
private static prefix = 'DashReader:';
/**
* Log debug information (only in debug mode)
*/
static debug(...args: unknown[]): void {
if (DEBUG) {
console.debug(this.prefix, ...args);
}
}
/**
* Log warnings (only in debug mode)
*/
static warn(...args: unknown[]): void {
if (DEBUG) {
console.warn(this.prefix, ...args);
}
}
/**
* Log errors (always shown)
*/
static error(...args: unknown[]): void {
console.error(this.prefix, ...args);
}
}