smartlog/ts/smartlog.classes.logrouter.ts

24 lines
589 B
TypeScript

import * as plugins from './smartlog.plugins';
import { ILogDestination, ILogPackage } from '@pushrocks/smartlog-interfaces';
export class LogRouter {
/**
* all log destinations
*/
private logDestinations: ILogDestination[] = [];
constructor() {}
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);
}
}
}