summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/logf
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2016-08-04 20:46:11 +0200
committertv <tv@krebsco.de>2016-08-04 20:46:11 +0200
commit71a25b18755ea229be17ca01003a68471ff72760 (patch)
treed4502fef0a924fed92191f3901f9aab3376ee6d2 /krebs/5pkgs/logf
parenta264c571f3b3bc096df11f84f8fd8c48ff591923 (diff)
logf: make urgency patterns configurable
Diffstat (limited to 'krebs/5pkgs/logf')
-rw-r--r--krebs/5pkgs/logf/default.nix10
1 files changed, 7 insertions, 3 deletions
diff --git a/krebs/5pkgs/logf/default.nix b/krebs/5pkgs/logf/default.nix
index b575c1879..d9eae0a4a 100644
--- a/krebs/5pkgs/logf/default.nix
+++ b/krebs/5pkgs/logf/default.nix
@@ -16,12 +16,15 @@ let
"7" = 139; # debug
"-" = 005; # undefined priority
};
+ default-urgent = pkgs.writeJSON "logf.default-urgent.json" [
+ ];
in
pkgs.writeDashBin "logf" ''
- export LOGF_HOST_COLORS LOGF_PRIO_COLORS
+ export LOGF_HOST_COLORS LOGF_PRIO_COLORS LOGF_URGENT
LOGF_HOST_COLORS=$(cat "''${LOGF_HOST_COLORS-${default-host-colors}}")
LOGF_PRIO_COLORS=$(cat "''${LOGF_PRIO_COLORS-${default-prio-colors}}")
+ LOGF_URGENT=$(cat "''${LOGF_URGENT-${default-urgent}}")
printf '%s\0' "$@" \
| ${pkgs.findutils}/bin/xargs -0 -P 0 -n 1 ${pkgs.writeDash "logf-remote" ''
target=$1
@@ -44,6 +47,8 @@ pkgs.writeDashBin "logf" ''
| ${pkgs.jq}/bin/jq -Rrf ${pkgs.writeJq "logf-filter.jq" ''
(env.LOGF_HOST_COLORS | fromjson) as $host_colors |
(env.LOGF_PRIO_COLORS | fromjson) as $prio_colors |
+ (env.LOGF_URGENT | fromjson | map("(\(.))") | join("|"))
+ as $urgent_regex |
def when(c; f): if c then f else . end;
@@ -89,8 +94,7 @@ pkgs.writeDashBin "logf" ''
as $prio_c |
.MESSAGE
| sub("\r$"; "")
- | agsub("\\btv@nomic\\b"; "\(.)\u0007" | col(fg(219); $prio_c))
- #| agsub("Start queue"; "\(.)\u0007" | col(fg(42); $prio_c))
+ | agsub($urgent_regex; "\(.)\u0007" | col(fg(219); $prio_c))
| col($prio_c);
try fromjson catch {