Logs: Added support for numeric log levels (#87366)

* logs: add support for numeric loglevels

* Log types: add a numeric level map to LogLevel

* getLogLevelFromKey: adapt to support numeric levels

* Formatting

* getLogLevelFromKey: accept strings or numbers

---------

Co-authored-by: Matias Chomicki <matyax@gmail.com>
This commit is contained in:
Dmitry Bashkatov
2024-06-05 13:56:36 +02:00
committed by GitHub
co-authored by Matias Chomicki
parent f262880b68
commit 17525ad43f
5 changed files with 61 additions and 12 deletions
+15
View File
@@ -33,6 +33,21 @@ export enum LogLevel {
unknown = 'unknown',
}
/**
* Mapping of log level abbreviation to canonical log level.
* Supported levels are reduce to limit color variation.
*/
export const NumericLogLevel: Record<string, LogLevel> = {
'0': LogLevel.critical,
'1': LogLevel.critical,
'2': LogLevel.critical,
'3': LogLevel.error,
'4': LogLevel.warning,
'5': LogLevel.info,
'6': LogLevel.info,
'7': LogLevel.debug,
};
// Used for meta information such as common labels or returned log rows in logs view in Explore
export enum LogsMetaKind {
Number,