@push.rocks/smartlog
Version:
A minimalistic, distributed, and extensible logging tool supporting centralized log management.
22 lines (17 loc) • 612 B
text/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);
}
}
}