UNPKG

soop-chat-client

Version:
21 lines (20 loc) 691 B
export class Logger { name = 'log'; isEnabled = true; constructor(name, isEnabled) { this.name = name; this.isEnabled = isEnabled; } verbose = (msg, ...optionalParams) => { this.isEnabled && console.log(`[${this.name}:verbose]`, new Date().toISOString(), msg, ...optionalParams); }; info = (msg, ...optionalParams) => { this.isEnabled && console.info(`[${this.name}:info]`, new Date().toISOString(), msg, ...optionalParams); }; warn = (msg, ...optionalParams) => { this.isEnabled && console.warn(`[${this.name}:warn]`, new Date().toISOString(), msg, ...optionalParams); }; }