kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
feat: print severity in debug output
rodzic
ba3f90ec44
commit
0886ba63d1
|
@ -16,6 +16,17 @@ export enum Severity {
|
||||||
CRITICAL = 4
|
CRITICAL = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Strings to represent severity levels.
|
||||||
|
*/
|
||||||
|
const SEVERITY_STRINGS: Record<Severity, string> = {
|
||||||
|
[Severity.DEBUG]: 'DEBUG',
|
||||||
|
[Severity.INFO]: 'INFO',
|
||||||
|
[Severity.WARNING]: 'WARNING',
|
||||||
|
[Severity.ERROR]: 'ERROR',
|
||||||
|
[Severity.CRITICAL]: 'CRITICAL'
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Functions to colorize text based on severity level.
|
* Functions to colorize text based on severity level.
|
||||||
*/
|
*/
|
||||||
|
@ -57,9 +68,9 @@ logger.formatArgs = function formatArgs(args) {
|
||||||
const name = this.namespace
|
const name = this.namespace
|
||||||
const dateTime = showDateTime ? new Date().toISOString() : ''
|
const dateTime = showDateTime ? new Date().toISOString() : ''
|
||||||
const colorFn = SEVERITY_COLORS[severity] || identity
|
const colorFn = SEVERITY_COLORS[severity] || identity
|
||||||
const prefix = colorFn(SPACE + name + SPACE)
|
const prefix = colorFn(SPACE + SEVERITY_STRINGS[severity] + SPACE)
|
||||||
args[0] = dateTime + prefix + args[0].split('\n').join('\n' + INDENT + prefix)
|
args[0] =
|
||||||
// args.push('+' + logger.humanize(this.diff));
|
dateTime + name + prefix + args[0].split('\n').join('\n' + INDENT + prefix)
|
||||||
|
|
||||||
// Remove the severity level from the logged arguments:
|
// Remove the severity level from the logged arguments:
|
||||||
args.pop()
|
args.pop()
|
||||||
|
|
Ładowanie…
Reference in New Issue