mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-17 15:32:01 +00:00
40 lines
647 B
TypeScript
40 lines
647 B
TypeScript
class Logger {
|
|
private isEnabled: boolean;
|
|
|
|
constructor() {
|
|
// __DEV__ is a global variable in React Native
|
|
this.isEnabled = __DEV__;
|
|
}
|
|
|
|
log(...args: any[]) {
|
|
if (this.isEnabled) {
|
|
console.log(...args);
|
|
}
|
|
}
|
|
|
|
error(...args: any[]) {
|
|
if (this.isEnabled) {
|
|
console.error(...args);
|
|
}
|
|
}
|
|
|
|
warn(...args: any[]) {
|
|
if (this.isEnabled) {
|
|
console.warn(...args);
|
|
}
|
|
}
|
|
|
|
info(...args: any[]) {
|
|
if (this.isEnabled) {
|
|
console.info(...args);
|
|
}
|
|
}
|
|
|
|
debug(...args: any[]) {
|
|
if (this.isEnabled) {
|
|
console.debug(...args);
|
|
}
|
|
}
|
|
}
|
|
|
|
export const logger = new Logger();
|