Add trace log level, traceCall decorator and use in webgl
- New 'trace' log level in the API, you should expect very spammy logs when trace is on and filter them down. As opposed to 'debug' which should be more readable. - traceCall decorator logs the args and return value of the decorated method. Wecan use this on key functions in various parts of the code to assist debugging issues that are hard to reproduce such as #4665. - Decorated a few webgl render methods for #4665. - There's an early exit in traceCall when not on the trace log level so the runtime impact when not in trace is negligable. Part of #4665
This commit is contained in:
Vendored
+13
-7
@@ -11,7 +11,7 @@ declare module 'xterm-headless' {
|
||||
/**
|
||||
* A string representing log level.
|
||||
*/
|
||||
export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'off';
|
||||
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'off';
|
||||
|
||||
/**
|
||||
* An object containing options for the terminal.
|
||||
@@ -100,11 +100,12 @@ declare module 'xterm-headless' {
|
||||
* What log level to use, this will log for all levels below and including
|
||||
* what is set:
|
||||
*
|
||||
* 1. debug
|
||||
* 2. info (default)
|
||||
* 3. warn
|
||||
* 4. error
|
||||
* 5. off
|
||||
* 1. trace
|
||||
* 2. debug
|
||||
* 3. info (default)
|
||||
* 4. warn
|
||||
* 5. error
|
||||
* 6. off
|
||||
*/
|
||||
logLevel?: LogLevel;
|
||||
|
||||
@@ -314,9 +315,14 @@ declare module 'xterm-headless' {
|
||||
* A replacement logger for `console`.
|
||||
*/
|
||||
export interface ILogger {
|
||||
/**
|
||||
* Log a trace message, this will only be called if
|
||||
* {@link ITerminalOptions.logLevel} is set to trace.
|
||||
*/
|
||||
trace(message: string, ...args: any[]): void;
|
||||
/**
|
||||
* Log a debug message, this will only be called if
|
||||
* {@link ITerminalOptions.logLevel} is set to debug.
|
||||
* {@link ITerminalOptions.logLevel} is set to debug or below.
|
||||
*/
|
||||
debug(message: string, ...args: any[]): void;
|
||||
/**
|
||||
|
||||
Vendored
+13
-7
@@ -18,7 +18,7 @@ declare module 'xterm' {
|
||||
/**
|
||||
* A string representing log level.
|
||||
*/
|
||||
export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'off';
|
||||
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'off';
|
||||
|
||||
/**
|
||||
* An object containing options for the terminal.
|
||||
@@ -158,11 +158,12 @@ declare module 'xterm' {
|
||||
* What log level to use, this will log for all levels below and including
|
||||
* what is set:
|
||||
*
|
||||
* 1. debug
|
||||
* 2. info (default)
|
||||
* 3. warn
|
||||
* 4. error
|
||||
* 5. off
|
||||
* 1. trace
|
||||
* 2. debug
|
||||
* 3. info (default)
|
||||
* 4. warn
|
||||
* 5. error
|
||||
* 6. off
|
||||
*/
|
||||
logLevel?: LogLevel;
|
||||
|
||||
@@ -391,9 +392,14 @@ declare module 'xterm' {
|
||||
* A replacement logger for `console`.
|
||||
*/
|
||||
export interface ILogger {
|
||||
/**
|
||||
* Log a trace message, this will only be called if
|
||||
* {@link ITerminalOptions.logLevel} is set to trace.
|
||||
*/
|
||||
trace(message: string, ...args: any[]): void;
|
||||
/**
|
||||
* Log a debug message, this will only be called if
|
||||
* {@link ITerminalOptions.logLevel} is set to debug.
|
||||
* {@link ITerminalOptions.logLevel} is set to debug or below.
|
||||
*/
|
||||
debug(message: string, ...args: any[]): void;
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user