Comparing version 5.3.0-beta.1 to 5.3.0-beta.2
{ | ||
"name": "xterm", | ||
"description": "Full xterm terminal, in your browser", | ||
"version": "5.3.0-beta.1", | ||
"version": "5.3.0-beta.2", | ||
"main": "lib/xterm.js", | ||
@@ -6,0 +6,0 @@ "style": "css/xterm.css", |
@@ -60,3 +60,3 @@ /** | ||
this._evalLazyOptionalParams(optionalParams); | ||
type.call(console, LOG_PREFIX + message, ...optionalParams); | ||
type.call(console, (this._optionsService.options.logger ? '' : LOG_PREFIX) + message, ...optionalParams); | ||
} | ||
@@ -66,3 +66,3 @@ | ||
if (this.logLevel <= LogLevelEnum.DEBUG) { | ||
this._log(console.log, message, optionalParams); | ||
this._log(this._optionsService.options.logger?.debug ?? console.log, message, optionalParams); | ||
} | ||
@@ -73,3 +73,3 @@ } | ||
if (this.logLevel <= LogLevelEnum.INFO) { | ||
this._log(console.info, message, optionalParams); | ||
this._log(this._optionsService.options.logger?.info ?? console.info, message, optionalParams); | ||
} | ||
@@ -80,3 +80,3 @@ } | ||
if (this.logLevel <= LogLevelEnum.WARN) { | ||
this._log(console.warn, message, optionalParams); | ||
this._log(this._optionsService.options.logger?.warn ?? console.warn, message, optionalParams); | ||
} | ||
@@ -87,5 +87,5 @@ } | ||
if (this.logLevel <= LogLevelEnum.ERROR) { | ||
this._log(console.error, message, optionalParams); | ||
this._log(this._optionsService.options.logger?.error ?? console.error, message, optionalParams); | ||
} | ||
} | ||
} |
@@ -30,2 +30,3 @@ /** | ||
logLevel: 'info', | ||
logger: null, | ||
scrollback: 1000, | ||
@@ -32,0 +33,0 @@ scrollOnUserInput: true, |
@@ -10,3 +10,3 @@ /** | ||
import { createDecorator } from 'common/services/ServiceRegistry'; | ||
import { IDecorationOptions, IDecoration, ILinkHandler, IWindowsPty } from 'xterm'; | ||
import { IDecorationOptions, IDecoration, ILinkHandler, IWindowsPty, ILogger } from 'xterm'; | ||
@@ -233,2 +233,3 @@ export const IBufferService = createDecorator<IBufferService>('BufferService'); | ||
logLevel?: LogLevel; | ||
logger?: ILogger | null; | ||
macOptionIsMeta?: boolean; | ||
@@ -235,0 +236,0 @@ macOptionClickForcesSelection?: boolean; |
@@ -156,2 +156,7 @@ /** | ||
/** | ||
* A logger to use instead of `console`. | ||
*/ | ||
logger?: ILogger | null; | ||
/** | ||
* Whether to treat option as the meta key. | ||
@@ -370,2 +375,28 @@ */ | ||
/** | ||
* A replacement logger for `console`. | ||
*/ | ||
export interface ILogger { | ||
/** | ||
* Log a debug message, this will only be called if {@link ITerminalOptions.logLevel} is set to | ||
* debug. | ||
*/ | ||
debug(message: string, ...args: any[]): void; | ||
/** | ||
* Log a debug message, this will only be called if {@link ITerminalOptions.logLevel} is set to | ||
* info or below. | ||
*/ | ||
info(message: string, ...args: any[]): void; | ||
/** | ||
* Log a debug message, this will only be called if {@link ITerminalOptions.logLevel} is set to | ||
* warn or below. | ||
*/ | ||
warn(message: string, ...args: any[]): void; | ||
/** | ||
* Log a debug message, this will only be called if {@link ITerminalOptions.logLevel} is set to | ||
* error or below. | ||
*/ | ||
error(message: string | Error, ...args: any[]): void; | ||
} | ||
/** | ||
* An object that can be disposed via a dispose function. | ||
@@ -372,0 +403,0 @@ */ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2291743
23896