Mercurial > hg > orthanc-stone
diff Platforms/Wasm/logger.ts @ 603:70992b38aa8a
new routable logging system in STDIO mode + flag support (with no value) in StartupParametersBuilder + 80 col indent
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 29 Apr 2019 15:09:48 +0200 |
parents | 548eed46f535 |
children | 4eccf698e52f |
line wrap: on
line diff
--- a/Platforms/Wasm/logger.ts Mon Apr 29 14:40:01 2019 +0200 +++ b/Platforms/Wasm/logger.ts Mon Apr 29 15:09:48 2019 +0200 @@ -10,6 +10,10 @@ this._debug(LogSource.Typescript, ...args); } + public debugFromCpp(...args: any[]): void { + this._debug(LogSource.Cpp, ...args); + } + public info(...args: any[]): void { this._info(LogSource.Typescript, ...args); } @@ -22,6 +26,10 @@ this._warning(LogSource.Typescript, ...args); } + public warningFromCpp(message: string): void { + this._warning(LogSource.Cpp, message); + } + public error(...args: any[]): void { this._error(LogSource.Typescript, ...args); } @@ -31,13 +39,25 @@ } public _debug(source: LogSource, ...args: any[]): void { - var output = this.getOutput(source, args); - console.debug(...output); + if ((<any> window).IsTraceLevelEnabled) + { + if ((<any> window).IsTraceLevelEnabled()) + { + var output = this.getOutput(source, args); + console.debug(...output); + } + } } private _info(source: LogSource, ...args: any[]): void { - var output = this.getOutput(source, args); - console.info(...output); + if ((<any> window).IsInfoLevelEnabled) + { + if ((<any> window).IsInfoLevelEnabled()) + { + var output = this.getOutput(source, args); + console.info(...output); + } + } } public _warning(source: LogSource, ...args: any[]): void { @@ -88,3 +108,4 @@ } export var defaultLogger: StandardConsoleLogger = new TimeConsoleLogger(); +