refactor: remove time-stamp dependency
This commit is contained in:
+3
-2
@@ -1,5 +1,4 @@
|
||||
import colors from "ansi-colors";
|
||||
import timestamp from "time-stamp";
|
||||
|
||||
const Level = {
|
||||
VERBOSE: -1,
|
||||
@@ -11,6 +10,8 @@ const Level = {
|
||||
|
||||
const level = process.argv.indexOf("--verbose") > -1 ? Level.VERBOSE : Level.INFO;
|
||||
|
||||
const formatTime = (date: Date): string => date.toTimeString().split(" ")[0];
|
||||
|
||||
export class Log {
|
||||
static level = level;
|
||||
|
||||
@@ -28,7 +29,7 @@ export class Log {
|
||||
|
||||
static write(level: number, tag: string, pattern: string, ...args: any) {
|
||||
if (level >= this.level) {
|
||||
const message = `[${colors.gray(timestamp("HH:mm:ss"))}] ${colors.green(tag)} ${this.colorize(pattern)}`;
|
||||
const message = `[${colors.gray(formatTime(new Date()))}] ${colors.green(tag)} ${this.colorize(pattern)}`;
|
||||
console.log(message, ...args);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user