smartlog/ts/smartlog.classes.logrouter.ts
2023-07-12 19:21:36 +02:00

22 lines
612 B
TypeScript

import * as plugins from './smartlog.plugins.js';
export class LogRouter {
/**
* all log destinations
*/
private logDestinations: plugins.smartlogInterfaces.ILogDestination[] = [];
constructor() {}
public addLogDestination(logDestination: plugins.smartlogInterfaces.ILogDestination) {
this.logDestinations.push(logDestination);
}
// routes the log according to added logDestinations
public async routeLog(logPackageArg: plugins.smartlogInterfaces.ILogPackage) {
for (const logDestination of this.logDestinations) {
await logDestination.handleLog(logPackageArg);
}
}
}