##// END OF EJS Templates
Code cleanup,...
Code cleanup, remove explicit export object from modules initial work docs/observable.ru.md

File last commit:

r22:93dca6f27f52 propose observables
r22:93dca6f27f52 propose observables
Show More
ConsoleWriter.ts
28 lines | 1.0 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
working on Observable
r14 import { Cancellation } from "../../Cancellation";
cin
Code cleanup,...
r22 import { TraceEvent, LogLevel, WarnLevel } from "../TraceSource";
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) {
var subscription = source.on(this.writeEvent.bind(this));
if (ct.isSupported()) {
ct.register(subscription.destroy.bind(subscription));
}
this._subscriptions.push(subscription);
}
writeEvent(next: TraceEvent) {
cin
Code cleanup,...
r22 if (next.level >= LogLevel) {
cin
fixed format-compile bug while formatting strings with new line symbols....
r15 console.log(next.source.id.toString(), next.arg);
cin
Code cleanup,...
r22 } else if(next.level >= WarnLevel) {
cin
fixed format-compile bug while formatting strings with new line symbols....
r15 console.warn(next.source.id.toString(), next.arg);
} else {
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() {
this._subscriptions.forEach(x => x.destroy());
cin
working on Observable
r14 }
cin
Code cleanup,...
r22 }