(combine-args-mw {:keys [vargs msg-type] :as data})
Middleware for formatting log arguments as strings
The timbre-json-appender
library eagerly considers logging
arguments to be data. Logging calls like (timbre/warn :foo 42)
would result in a) no message and b) {:args {:foo 42}}
See https://github.com/viesti/timbre-json-appender?tab=readme-ov-file#format-of-the-log-invocation
To work around this, we can use this middleware to produce the leading message string (and also include the arguments in a map).
Middleware for formatting log arguments as strings The `timbre-json-appender` library eagerly considers logging arguments to be data. Logging calls like `(timbre/warn :foo 42)` would result in a) no message and b) {:args {:foo 42}} See https://github.com/viesti/timbre-json-appender?tab=readme-ov-file#format-of-the-log-invocation To work around this, we can use this middleware to produce the leading message string (and also include the arguments in a map).
(string-stack-trace-mw {:keys [?err] :as data})
Adds stack_trace
for logging errors for GCP and removes the ?err
key containing the exception.
timbre-json-appender
would create a nested map from the error with Throwable->map
, but that is not useful
for error reporting in GCP which does not recognize that format.
Additionally, timbre-json-appender
can fail to log JSON if the Throwable data is not serializable or if
the serialization causes an error in itself (e.g. with a component system map in the exception resulting
in a stack overflow). It falls back to the basic text appender in that situation, polluting logs. To avoid this,
the ?err
key is removed completely from the log data.
Adds `stack_trace` for logging errors for GCP and removes the `?err` key containing the exception. `timbre-json-appender` would create a nested map from the error with `Throwable->map`, but that is not useful for error reporting in GCP which does not recognize that format. Additionally, `timbre-json-appender` can fail to log JSON if the Throwable data is not serializable or if the serialization causes an error in itself (e.g. with a component system map in the exception resulting in a stack overflow). It falls back to the basic text appender in that situation, polluting logs. To avoid this, the `?err` key is removed completely from the log data.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close