such as the picture shows, the msg contains the word “Error” so it shows red
Is there a place to block this feature?
I hope some friends can help answer~~~
1 Like
I am also interested to know how the colorization is done (by what queries) and whether that is customizable. I didn’t see this mentioned in the documentation anywhere.
I dug through the code a bit and found that it appears to be currently hard-coded, so it cannot be disabled or customized.
Some references:
-
packages\grafana-data\src\utils\logs.ts
definesgetLogLevel
-
getLogLevel
searches for strings defined inpackages\grafana-data\src\types\logs.ts
- Patterns are case-insensitive, surrounded by “\b”. For example, “\berr\b”, “\berror\b”, etc.
-
packages\grafana-ui\src\components\Logs\LogRow.tsx
- rendering of log rows -
packages\grafana-ui\src\components\Logs\getLogRowStyles.ts
- determines the actual colors based on the level
Here are all the log levels (string = ‘level’) for reference (based on current master branch):
/**
* Mapping of log level abbreviation to canonical log level.
* Supported levels are reduce to limit color variation.
*/
export enum LogLevel {
emerg = 'critical',
fatal = 'critical',
alert = 'critical',
crit = 'critical',
critical = 'critical',
warn = 'warning',
warning = 'warning',
err = 'error',
eror = 'error',
error = 'error',
info = 'info',
information = 'info',
notice = 'info',
dbug = 'debug',
debug = 'debug',
trace = 'trace',
unknown = 'unknown',
}
ok, thank you~, I viewed the official docs and also not find how to cancel