Skip to content

Commit

Permalink
Saner logging
Browse files Browse the repository at this point in the history
  • Loading branch information
dubo-dubon-duponey committed Feb 23, 2024
1 parent d8b4224 commit 9d5988c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
23 changes: 21 additions & 2 deletions context/runtime/boot/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,29 @@ helpers::dir::writable "$XDG_DATA_DIRS" create
helpers::dir::writable "$ROON_ID_DIR" create
helpers::dir::writable "$ROON_DATAROOT" create

# Get the main logs into stdout, whenever they are created
LOG_LEVEL="${LOG_LEVEL:-}"
normalized_log_level="$(printf "%s" "$LOG_LEVEL" | tr '[:upper:]' '[:lower:]')"
case "$normalized_log_level" in
"debug")
reg="Trace"
;;
"info")
reg="Trace|Debug"
;;
"warning")
reg="Trace|Debug|Info"
;;
"error")
reg="Trace|Debug|Warn"
;;
esac
reg="^[0-9/: ]*(?:$reg)"

# Get the main logs into stdout, whenever they are created - and artificially filter out...
log::ingest(){
local fd="$1"
tail -F "$fd"
# So... hide out whatever
tail -F "$fd" 2>/dev/null | grep -Pv "$reg"
}

# Get rid of the rotated logs,
Expand Down
2 changes: 1 addition & 1 deletion context/runtime/boot/mdns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mdns::records::add(){
local host="$2"
local name="${3:-$host}"
local port="${4:-9}"
local text="${5:-[]}"
local text="${5:-[\"\"]}" # XXX Goello bug - if [] the announce if not visible
_internal_mod_mdns_records+=("$(printf '{"Type": "%s", "Host": "%s", "Name": "%s", "Port": %s, "Text": %s}' "$type" "$host" "$name" "$port" "$text")")
}

Expand Down

0 comments on commit 9d5988c

Please sign in to comment.