smartlog/ts/smartlog.classes.logrouter.ts

22 lines
612 B
TypeScript
Raw Normal View History

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