Closed torkus closed 3 years ago
Using a middleware should work. This is untested:
{:level :info
:middleware [(fn [d] (assoc d :hostname_ (delay "")))]
}
@xificurC Thanks Peter!
All I want to do is drop the hostname field and give it a sane timestamp but it's getting crazy.
It's been a little while but I've returned to this problem and have figured out how to print the stacktrace like the native println-appender
does.
(defn anon-println-appender
"removes the hostname from the output format string"
[data]
(let [{:keys [?err timestamp_ msg_ level ?ns-str ?line]} data]
(when ?err
(println (timbre/stacktrace ?err)))
(println (format "%s %s [%s:%s] %s"
(force timestamp_) level (force ?ns-str) (force ?line) (force msg_)))))
I'm trying to create a more-anonymous log line that drops the hostname information but have now lost the ability to print stacktraces when an exception object is the first argument. I think I may be over-complicating things. This is what I have:
All I want to do is drop the
hostname
field and give it a sane timestamp but it's getting crazy.Any insight on how I can do this properly? Thank you