mirror of
https://github.com/sern-handler/handler
synced 2026-06-28 02:32:15 +00:00
some date parsing
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import dayjs from "dayjs"
|
||||
import utc from "dayjs/plugin/utc"
|
||||
import timezone from "dayjs/plugin/timezone"
|
||||
export class DefaultLogger implements Logger<DefaultEvent> {
|
||||
|
||||
clear () {
|
||||
@@ -5,7 +8,11 @@ export class DefaultLogger implements Logger<DefaultEvent> {
|
||||
}
|
||||
|
||||
log(message: string, e: DefaultEvent) {
|
||||
console.log(`[${DefaultEvent[e]}] ${message}`)
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
dayjs.tz.guess()
|
||||
const tz = dayjs().format()
|
||||
console.log(`[${tz}][${DefaultEvent[e]}] ${message}`)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { possibleOutput } from "../types/handler"
|
||||
import { Ok, Result, None, Some } from "ts-results";
|
||||
import type * as Utils from "./utils/preprocessors/args";
|
||||
import { CtxHandler } from "./utils/ctxHandler";
|
||||
import { DefaultLogger, Logger } from "./logger";
|
||||
import { DefaultEvent, DefaultLogger, Logger } from "./logger";
|
||||
|
||||
|
||||
/**
|
||||
@@ -26,9 +26,10 @@ export class Handler {
|
||||
logger === undefined
|
||||
? this.logger = new DefaultLogger()
|
||||
: this.logger = logger;
|
||||
|
||||
this.logger.clear();
|
||||
|
||||
this.logger.clear();
|
||||
this.logger.log("joe", DefaultEvent.MESSAGE);
|
||||
|
||||
|
||||
this.wrapper.client
|
||||
.on("ready", async () => {
|
||||
|
||||
Reference in New Issue
Block a user