##// END OF EJS Templates
fixed format-compile bug while formatting strings with new line symbols....
fixed format-compile bug while formatting strings with new line symbols. added error and completion handlers to Observable ConsoleTraceWriter is now destroyable

File last commit:

r15:d5a3d3ab9fd7 propose cancellat...
r15:d5a3d3ab9fd7 propose cancellat...
Show More
ConsoleWriter.ts
34 lines | 1.1 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 * as TraceEvent from '../TraceEvent';
import { Cancellation } from "../../Cancellation";
import * as TraceSource from "../TraceSource";
cin
fixed format-compile bug while formatting strings with new line symbols....
r15 class ConsoleWriter implements IDestroyable {
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) {
if (next.level >= TraceSource.LogLevel) {
console.log(next.source.id.toString(), next.arg);
} else if(next.level >= TraceSource.WarnLevel) {
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 }
}
namespace ConsoleWriter {
}
export = ConsoleWriter;