Add Trace logging level; bump version
This commit is contained in:
15
src/util/error/DebuggingTraceIsNotAnError.ts
Normal file
15
src/util/error/DebuggingTraceIsNotAnError.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Error class used to generate debug stack traces, not thrown.
|
||||
*/
|
||||
export class DebuggingTraceIsNotAnError extends Error {
|
||||
static getTrace(): string {
|
||||
const oldLimit = Error.stackTraceLimit
|
||||
if ( oldLimit < 50 ) {
|
||||
Error.stackTraceLimit = 50
|
||||
}
|
||||
|
||||
const trace = (new this()).stack || String(new this())
|
||||
Error.stackTraceLimit = oldLimit
|
||||
return trace
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ export * from './const/http'
|
||||
|
||||
export * from './error/ErrorWithContext'
|
||||
export * from './error/MethodNotSupportedError'
|
||||
export * from './error/DebuggingTraceIsNotAnError'
|
||||
|
||||
export * from './logging/Logger'
|
||||
export * from './logging/StandardLogger'
|
||||
|
||||
@@ -44,6 +44,8 @@ export abstract class Logger {
|
||||
return color.cyan(' debug')
|
||||
case LoggingLevel.Verbose:
|
||||
return color.gray('verbose')
|
||||
case LoggingLevel.Trace:
|
||||
return color.dim(' trace')
|
||||
case LoggingLevel.Silent:
|
||||
return color.gray(' silent')
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ enum LoggingLevel {
|
||||
Info = 4,
|
||||
Debug = 5,
|
||||
Verbose = 6,
|
||||
Trace = 7,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user