mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 10:48:12 +02:00
contrib/NM-log: colorize warnings and errors in red
- remove "\r\n" line endings - colorize <warn> and <error> in red - extend matching the info levels to include the timestamp. This (intentionally) will no longer highlight messages from ModemManager, which don't include a timestamp.
This commit is contained in:
parent
cffde0101e
commit
b20fc58b3c
1 changed files with 3 additions and 1 deletions
|
|
@ -34,7 +34,9 @@ NM-colorize() {
|
||||||
if [[ "$NM_LOG_NO_COLOR" == "" ]]; then
|
if [[ "$NM_LOG_NO_COLOR" == "" ]]; then
|
||||||
# poor man's coloring using grep.
|
# poor man's coloring using grep.
|
||||||
# TODO: do it somehow better (and more efficient).
|
# TODO: do it somehow better (and more efficient).
|
||||||
GREP_COLOR='01;33' grep -a --color=always '^\|^\(.* \)\?<\(warn>\|info> \|error>\) \(.*\<is starting\>.*$\)\?' | \
|
sed 's/\r$//' | \
|
||||||
|
GREP_COLOR='01;31' grep -a --color=always '^\|^\(.* \)\?<\(warn> \|error>\) \[[0-9.]*\] ' | \
|
||||||
|
GREP_COLOR='01;33' grep -a --color=always '^\|^\(.* \)\?<info> \[[0-9.]*\] \(.*\<is starting\>.*$\)\?' | \
|
||||||
GREP_COLOR='01;37' grep -a --color=always '^\|\<platform: signal: .*$' | \
|
GREP_COLOR='01;37' grep -a --color=always '^\|\<platform: signal: .*$' | \
|
||||||
GREP_COLOR='01;34' grep -a --color=always '^\|\<platform-linux: link: change \|\<platform: link: setting .*$\|\<platform: \(route\|address\): .*$\|\<platform-linux: sysctl: setting .*$' | \
|
GREP_COLOR='01;34' grep -a --color=always '^\|\<platform-linux: link: change \|\<platform: link: setting .*$\|\<platform: \(route\|address\): .*$\|\<platform-linux: sysctl: setting .*$' | \
|
||||||
GREP_COLOR='01;35' grep -a --color=always '^\| audit: .*$' | \
|
GREP_COLOR='01;35' grep -a --color=always '^\| audit: .*$' | \
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue