Add Trace logging level; bump version

This commit is contained in:
2022-03-30 18:15:56 -05:00
parent 508d92f759
commit ca348b2ff6
7 changed files with 30 additions and 3 deletions

View 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
}
}

View File

@@ -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'

View File

@@ -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')
}

View File

@@ -9,6 +9,7 @@ enum LoggingLevel {
Info = 4,
Debug = 5,
Verbose = 6,
Trace = 7,
}
/**