smartlog/ts/smartlog.classes.logrouter.ts

24 lines
589 B
TypeScript
Raw Normal View History

2018-06-05 18:48:14 +00:00
import * as plugins from './smartlog.plugins';
2018-03-03 12:57:55 +00:00
2018-10-30 17:56:26 +00:00
import { ILogDestination, ILogPackage } from '@pushrocks/smartlog-interfaces';
2018-03-03 12:57:55 +00:00
export class LogRouter {
2018-10-30 17:56:26 +00:00
/**
* all log destinations
*/
private logDestinations: ILogDestination[] = [];
2018-06-05 18:48:14 +00:00
constructor() {}
2018-03-03 12:57:55 +00:00
2018-10-30 17:56:26 +00:00
public addLogDestination(logDestination: ILogDestination) {
this.logDestinations.push(logDestination);
}
// routes the log according to added logDestinations
routeLog(logPackageArg: ILogPackage) {
for (const logDestination of this.logDestinations) {
logDestination.handleLog(logPackageArg);
}
}
2018-06-05 18:48:14 +00:00
}