##// END OF EJS Templates
working on multi-platform support
working on multi-platform support

File last commit:

r45:3c6524f04866 di-typescript
r48:2ef1241803ee di-typescript
Show More
ConsoleWriter.ts
36 lines | 1.3 KiB | video/mp2t | TypeScriptLexer
/ src / ts / log / writers / ConsoleWriter.ts
cin
fixed format-compile bug while formatting strings with new line symbols....
r15 import { IObservable, IDestroyable, ICancellation } from "../../interfaces";
cin
minor fixes
r45 import { TraceEvent, LogLevel, WarnLevel, DebugLevel } from "../TraceSource";
cin
working on Observable
r14 import { Cancellation } from "../../Cancellation";
cin
minor fixes
r45 import { destroy } from "../../safe";
cin
working on Observable
r14
cin
Code cleanup,...
r22 export class ConsoleWriter implements IDestroyable {
cin
fixed format-compile bug while formatting strings with new line symbols....
r15 readonly _subscriptions = new Array<IDestroyable>();
writeEvents(source: IObservable<TraceEvent>, ct: ICancellation = Cancellation.none) {
cin
minor fixes
r45 const subscription = source.on(this.writeEvent.bind(this));
cin
fixed format-compile bug while formatting strings with new line symbols....
r15 if (ct.isSupported()) {
ct.register(subscription.destroy.bind(subscription));
}
this._subscriptions.push(subscription);
}
writeEvent(next: TraceEvent) {
cin
minor fixes
r45 if (next.level >= DebugLevel) {
// tslint:disable-next-line
console.debug(next.source.id.toString(), next.arg);
} else if (next.level >= LogLevel) {
// tslint:disable-next-line
cin
fixed format-compile bug while formatting strings with new line symbols....
r15 console.log(next.source.id.toString(), next.arg);
cin
minor fixes
r45 } else if (next.level >= WarnLevel) {
// tslint:disable-next-line
cin
fixed format-compile bug while formatting strings with new line symbols....
r15 console.warn(next.source.id.toString(), next.arg);
} else {
cin
minor fixes
r45 // tslint:disable-next-line
cin
fixed format-compile bug while formatting strings with new line symbols....
r15 console.error(next.source.id.toString(), next.arg);
cin
working on Observable
r14 }
}
cin
fixed format-compile bug while formatting strings with new line symbols....
r15 destroy() {
cin
minor fixes
r45 this._subscriptions.forEach(destroy);
cin
working on Observable
r14 }
cin
minor fixes
r45 }