(feat): Allow transports to ignore .

Transports which do not supply   will process all log events.
This commit is contained in:
Nix "UwU" Krystik
2026-03-11 21:04:40 +08:00
parent ce518c46c0
commit 40b08fc804
2 changed files with 2 additions and 2 deletions

View File

@@ -12,7 +12,7 @@ export class Logger {
const tasks: Promise<void>[] = []; const tasks: Promise<void>[] = [];
for (const transport of this.transports) { for (const transport of this.transports) {
if (level >= transport.minLevel) { if (!transport.minLevel || level >= transport.minLevel) {
tasks.push(transport.log(level, module, content)); tasks.push(transport.log(level, module, content));
} }
} }

View File

@@ -1,7 +1,7 @@
import LogLevel from './LogLevel'; import LogLevel from './LogLevel';
interface Transport { interface Transport {
minLevel: LogLevel; minLevel?: LogLevel;
log(level: LogLevel, module: string, content: string): Promise<void>; log(level: LogLevel, module: string, content: string): Promise<void>;
} }