Introduced a new eslint.config.js using neostandard and added related devDependencies. Updated codebase for consistent formatting, spacing, and function declarations. Minor refactoring and cleanup across multiple files to improve readability and maintain code style compliance.
36 lines
801 B
TypeScript
36 lines
801 B
TypeScript
import { NapCoreContext } from '@/napcat-core/packet/context/napCoreContext';
|
|
import { LogWrapper, LogLevel } from '@/napcat-core/helper/log';
|
|
|
|
// TODO: check bind?
|
|
export class PacketLogger {
|
|
private readonly napLogger: LogWrapper;
|
|
|
|
constructor (napcore: NapCoreContext) {
|
|
this.napLogger = napcore.logger;
|
|
}
|
|
|
|
private _log (level: LogLevel, ...msg: any[]): void {
|
|
this.napLogger._log(level, '[Core] [Packet] ' + msg);
|
|
}
|
|
|
|
debug (...msg: any[]): void {
|
|
this._log(LogLevel.DEBUG, msg);
|
|
}
|
|
|
|
info (...msg: any[]): void {
|
|
this._log(LogLevel.INFO, msg);
|
|
}
|
|
|
|
warn (...msg: any[]): void {
|
|
this._log(LogLevel.WARN, msg);
|
|
}
|
|
|
|
error (...msg: any[]): void {
|
|
this._log(LogLevel.ERROR, msg);
|
|
}
|
|
|
|
fatal (...msg: any[]): void {
|
|
this._log(LogLevel.FATAL, msg);
|
|
}
|
|
}
|