Files
NapCatQQ/packages/napcat-core/packet/context/loggerContext.ts
T
手瓜一十雪 be87f1f8e5 feat: 大规模去耦合
Moved various helper, event, and utility files from napcat-common to napcat-core/helper for better modularity and separation of concerns. Updated imports across packages to reflect new file locations. Removed unused dependencies from napcat-common and added them to napcat-core where needed. Also consolidated type definitions and cleaned up tsconfig settings for improved compatibility.
2025-11-15 13:36:33 +08:00

37 lines
802 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);
}
}