Created
August 16, 2018 07:28
-
-
Save wzr1337/226d6b43a38f335492897fec1df11363 to your computer and use it in GitHub Desktop.
A small colorful, timestamping typescript logger class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Logger } from "./logger"; | |
Logger.log("just logging"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Logger { | |
public static log(...args: any[]) { | |
console.log(`[${new Date(Date.now())}]`, ...args); | |
} | |
public static debug(...args: any[]) { | |
console.log(`\x1b[33m[${new Date(Date.now())}]\x1b[0m`, ...args); | |
} | |
public static error(...args: any[]) { | |
console.log(`\x1b[31m[${new Date(Date.now())}]\x1b[0m`, ...args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment