cubetiq-ts-utils/src/log/index.ts
Sambo Chea b1b37b069f
All checks were successful
continuous-integration/drone/push Build is passing
Fixed the ts library and add rollup config for build
Fixed log tests and updated config
2021-03-11 11:32:42 +07:00

32 lines
708 B
TypeScript

import { Loggable } from './interfaces';
class Log {
static log(loggable: Loggable): void {
switch (loggable.type) {
case 'error':
this.error(loggable.from, loggable.data);
break;
case 'warn':
this.warn(loggable.from, loggable.data);
break;
default:
this.info(loggable.from, loggable.data);
break;
}
}
static info(...data: any[]): void {
console.log(data);
}
static error(...data: any[]): void {
console.error(data);
}
static warn(...data: any[]): void {
console.warn(data);
}
}
export default Log;