mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Refactor logger function to be more readable
This commit is contained in:
parent
871bae1924
commit
57400a12b3
@ -91,8 +91,13 @@ git_check() {
|
|||||||
|
|
||||||
# Log output to a file and only print lines with keywords
|
# Log output to a file and only print lines with keywords
|
||||||
logger() {
|
logger() {
|
||||||
local log="$RISCV/logs/$1.log"
|
local log_file="$RISCV/logs/$1.log"
|
||||||
cat < /dev/stdin | tee -a "$log" | (grep -iE --color=never "(\bwarning|\berror|\bfail|\bsuccess|\bstamp|\bdoesn't work)" || true) | (grep -viE --color=never "(_warning|warning_|_error|error_|-warning|warning-|-error|error-|Werror|error\.o|warning flags)" || true)
|
local keyword_pattern="(\bwarning|\berror|\bfail|\bsuccess|\bstamp|\bdoesn't work)"
|
||||||
|
local exclude_pattern="(_warning|warning_|_error|error_|-warning|warning-|-error|error-|Werror|error\.o|warning flags)"
|
||||||
|
|
||||||
|
cat < /dev/stdin | tee -a "$log_file" | \
|
||||||
|
(grep -iE --color=never "$keyword_pattern" || true) | \
|
||||||
|
(grep -viE --color=never "$exclude_pattern" || true)
|
||||||
}
|
}
|
||||||
|
|
||||||
set -e # break on error
|
set -e # break on error
|
||||||
|
Loading…
Reference in New Issue
Block a user