(feat): Allow transports to ignore .
Transports which do not supply will process all log events.
This commit is contained in:
@@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user