From 6d7495a765ad47a164b473b625029883d061bd9c Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Fri, 30 Aug 2024 09:38:30 +0200 Subject: [PATCH] [mod] `default-output-fn`: omit "?" location info Change intended to reduce unhelpful noise in output Before this commit: 2024-08-30T07:34:40.806Z MyHostName INFO [my.ns:126] - My message ; Have ns, line 2024-08-30T07:34:40.806Z MyHostName INFO [my.ns:?] - My message ; Have ns only 2024-08-30T07:34:40.806Z MyHostName INFO [?:?] - My message ; Have neither After this commit: 2024-08-30T07:34:40.806Z MyHostName INFO [my.ns:126] - My message ; Have ns, line (unchanged) 2024-08-30T07:34:40.806Z MyHostName INFO [my.ns] - My message ; Have ns only (omit "?") 2024-08-30T07:34:40.806Z MyHostName INFO - My message ; Have neither (omit "[?:?]") --- src/taoensso/timbre.cljc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/taoensso/timbre.cljc b/src/taoensso/timbre.cljc index 823b210..23f7da4 100644 --- a/src/taoensso/timbre.cljc +++ b/src/taoensso/timbre.cljc @@ -837,7 +837,10 @@ (when-let [ts (force timestamp_)] (str ts " ")) #?(:clj (force hostname_)) #?(:clj " ") (str/upper-case (name level)) " " - "[" (or ?ns-str ?file "?") ":" (or ?line "?") "] - " + ;; "[" (or ?ns-str ?file "?") ":" (or ?line "?") "] - " + (when-let [loc (or ?ns-str ?file)] + (str "[" loc (when-let [line ?line] (str ":" line)) "]")) + " - " (when-let [msg-fn (get output-opts :msg-fn default-output-msg-fn)] (msg-fn data))