feat: print severity in debug output

old-agentic-v1^2
Philipp Burckhardt 2023-06-26 19:30:06 -04:00
rodzic ba3f90ec44
commit 0886ba63d1
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: A2C3BCA4F31D1DDD
1 zmienionych plików z 14 dodań i 3 usunięć

Wyświetl plik

@ -16,6 +16,17 @@ export enum Severity {
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.
*/
@ -57,9 +68,9 @@ logger.formatArgs = function formatArgs(args) {
const name = this.namespace
const dateTime = showDateTime ? new Date().toISOString() : ''
const colorFn = SEVERITY_COLORS[severity] || identity
const prefix = colorFn(SPACE + name + SPACE)
args[0] = dateTime + prefix + args[0].split('\n').join('\n' + INDENT + prefix)
// args.push('+' + logger.humanize(this.diff));
const prefix = colorFn(SPACE + SEVERITY_STRINGS[severity] + SPACE)
args[0] =
dateTime + name + prefix + args[0].split('\n').join('\n' + INDENT + prefix)
// Remove the severity level from the logged arguments:
args.pop()