From 547892b9a6861df5cfa6302d0d091d9abd12fe78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Rune=20N=C3=B8stdal?= Date: Mon, 27 Jan 2020 12:02:11 +0000 Subject: [PATCH 1/2] Generate full stacktraces instead of just the exception message. We'll rely on the timbre/stacktrace Fn to do this -- so the output should more or less match what's seen in the default :println appender. --- src/clj_journal/timbre.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clj_journal/timbre.clj b/src/clj_journal/timbre.clj index dd9beeb..1060e30 100644 --- a/src/clj_journal/timbre.clj +++ b/src/clj_journal/timbre.clj @@ -23,7 +23,7 @@ ([err] (stacktrace err nil)) ([err _opts] - (str err))) + (taoensso.timbre/stacktrace err))) (defn journal-output-fn "journal (fn [data]) -> string output fn. From ba1349ecd142c6b62e19516e4154d9d9e8bc9f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Rune=20N=C3=B8stdal?= Date: Mon, 27 Jan 2020 12:50:59 +0000 Subject: [PATCH 2/2] Also include the log LEVEL in default message output format .. .. so things sort of match the default :println appender in Timbre. --- src/clj_journal/timbre.clj | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/clj_journal/timbre.clj b/src/clj_journal/timbre.clj index 1060e30..d3a535e 100644 --- a/src/clj_journal/timbre.clj +++ b/src/clj_journal/timbre.clj @@ -1,5 +1,6 @@ (ns clj-journal.timbre - (:require [clj-journal.log :refer [jsend]])) + (:require [clojure.string :as str] + [clj-journal.log :refer [jsend]])) (def timbre->syslog-map "Map timbre log levels to syslog levels" @@ -38,8 +39,9 @@ ([data] (journal-output-fn nil data)) ([opts data] ; For partials (let [{:keys [show-fields? no-stacktrace? stacktrace-fonts]} opts - {:keys [?err vargs msg_ ?ns-str ?file ?line]} data] - (str "[" (or ?ns-str ?file "?") ":" (or ?line "?") "] - " + {:keys [level ?err vargs msg_ ?ns-str ?file ?line]} data] + (str (str/upper-case (name level)) " " + "[" (or ?ns-str ?file "?") ":" (or ?line "?") "] - " (if show-fields? (force msg_) (clojure.string/join " " (filter (comp not map?) vargs)))