2025-04-23 09:34:08 +08:00

32 lines
728 B
TypeScript

import { configure, getLogger } from "log4js";
export default class log {
log:any = null
constructor(gametype:string) {
try {
console.log(__dirname + '/../logs/' + gametype + ".log")
configure({
appenders: { cheese: { type: "file", filename: __dirname + '/../../logs/' + gametype + ".log" } },
categories: { default: { appenders: ["cheese"], level: "all" } }
})
this.log = getLogger()
} catch(e) {console.log(e)}
}
public info(info:string) {
this.log.info(info)
}
public warn(info:string) {
this.log.warn(info)
}
public err(info:string) {
this.log.error(info)
}
}