smartlog/ts/smartlog.classes.logrouter.ts

22 lines
612 B
TypeScript
Raw Normal View History

2022-06-26 10:35:35 +02:00
import * as plugins from './smartlog.plugins.js';
2018-03-03 13:57:55 +01:00
export class LogRouter {
2018-10-30 18:56:26 +01:00
/**
* all log destinations
*/
2023-07-12 19:21:36 +02:00
private logDestinations: plugins.smartlogInterfaces.ILogDestination[] = [];
2018-10-30 18:56:26 +01:00
2018-06-05 20:48:14 +02:00
constructor() {}
2018-03-03 13:57:55 +01:00
2023-07-12 19:21:36 +02:00
public addLogDestination(logDestination: plugins.smartlogInterfaces.ILogDestination) {
2018-10-30 18:56:26 +01:00
this.logDestinations.push(logDestination);
}
// routes the log according to added logDestinations
2023-07-12 19:21:36 +02:00
public async routeLog(logPackageArg: plugins.smartlogInterfaces.ILogPackage) {
2018-10-30 18:56:26 +01:00
for (const logDestination of this.logDestinations) {
2020-06-11 10:11:37 +00:00
await logDestination.handleLog(logPackageArg);
2018-10-30 18:56:26 +01:00
}
}
2018-06-05 20:48:14 +02:00
}