nitro-renderer/src/api/common/NitroLogger.ts

31 lines
625 B
TypeScript
Raw Normal View History

2022-11-17 12:44:32 -05:00
export class NitroLogger
2021-03-16 22:02:09 -04:00
{
2022-11-17 12:44:32 -05:00
public static DEBUG_ENABLED: boolean = false;
2021-03-16 22:02:09 -04:00
2022-11-08 16:44:41 -05:00
public static log(...messages: any[]): void
{
2022-11-17 12:44:32 -05:00
if(!this.DEBUG_ENABLED) return;
2022-11-08 16:44:41 -05:00
console.log(this.logPrefix(), ...messages);
2021-03-16 22:02:09 -04:00
}
2022-11-08 16:44:41 -05:00
public static error(...messages: any[]): void
2022-03-21 01:53:14 -04:00
{
2022-11-17 12:44:32 -05:00
if(!this.DEBUG_ENABLED) return;
2022-11-08 16:44:41 -05:00
console.error(this.logPrefix(), ...messages);
2022-03-21 01:53:14 -04:00
}
2022-11-08 16:44:41 -05:00
public static warn(...messages: any[]): void
2021-03-16 22:02:09 -04:00
{
2022-11-17 12:44:32 -05:00
if(!this.DEBUG_ENABLED) return;
2021-03-16 22:02:09 -04:00
2022-11-17 12:44:32 -05:00
console.warn(this.logPrefix(), ...messages);
2021-03-16 22:02:09 -04:00
}
2022-11-17 12:44:32 -05:00
private static logPrefix(): string
2021-03-16 22:02:09 -04:00
{
2022-11-17 12:44:32 -05:00
return '[Nitro]';
2021-03-16 22:02:09 -04:00
}
}