Sambo Chea
9e9cbe1162
All checks were successful
continuous-integration/drone/push Build is passing
Add jest for test units Updated the package and lib
32 lines
703 B
TypeScript
32 lines
703 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;
|