Liking cljdoc? Tell your friends :D

timbre-json-appender.core


collect-vargsclj

(collect-vargs vargs)
source

count-format-specifiersclj

(count-format-specifiers format-string)
source

default-ex-data-field-fnclj

(default-ex-data-field-fn f)

Default function to pre-process fields in ex-info data map. This default implementation simply passes the field value through. A common use case might be to strip non-Serializable values from the ex-info data map. While exceptions with non-Serializable fields won't prevent logging, they will prevent successful JSON parsing and will use the fallback logger.

An :ex-data-field-fn of

(fn [f] (when (instance? java.io.Serializable f) f))

would replace the non-Serializable values with nils.

Default function to pre-process fields in ex-info data map. This default implementation simply passes the
field value through. A common use case might be to strip non-Serializable values from the ex-info data map.
While exceptions with non-Serializable fields won't prevent logging, they will prevent successful
JSON parsing and will use the fallback logger.

An `:ex-data-field-fn` of
```
(fn [f] (when (instance? java.io.Serializable f) f))
```
would replace the non-Serializable values with nils.
sourceraw docstring

default-key-namesclj

Default key names in the log map

Default key names in the log map
sourceraw docstring

default-should-log-field-fnclj

(default-should-log-field-fn field-name {:keys [?err] :as _data})

Default function to determine whether to log fields.

Logs all fields except :file :line and :ns which are only logged on error.

Default function to determine whether to log fields.

Logs all fields except :file :line and :ns which are only logged on error.
sourceraw docstring

handle-vargsclj

(handle-vargs log-map ?msg-fmt vargs inline-args? msg-key)

Handles varg parsing, adding the msg and the given context to the given log map.

If inline-args is true, then the remaining vargs are added to :args, otherwise they're inlined into the log-map.

Handles varg parsing, adding the msg and the given context to the given log map.

If inline-args is true, then the remaining vargs are added to :args,
otherwise they're inlined into the log-map.
sourceraw docstring

installclj

(install)
(install {:keys [level min-level pretty inline-args? level-key msg-key
                 should-log-field-fn ex-data-field-fn key-names json-error-fn]
          :or {level-key :level
               pretty false
               inline-args? true
               msg-key :msg
               should-log-field-fn default-should-log-field-fn
               ex-data-field-fn default-ex-data-field-fn
               key-names default-key-names
               json-error-fn (fn [_t])}})

Installs json-appender as the sole appender for Timbre, options

level: Timbre log level (deprecated, prefer min-level) min-level: Timbre log level level-key: The key to use for log-level msg-key: The key to use for the message (default :msg) pretty: Pretty-print JSON inline-args?: Place arguments on top level, instead of placing behind args field should-log-field-fn: A function which determines whether to log the given top-level field. Defaults to default-should-log-field-fn ex-data-field-fn: A function which pre-processes fields in the ex-info data map. Useful when ex-info data map includes non-Serializable values. Defaults to default-ex-data-field-fn key-names: Map of log key names. Can be used to override the default key names in default-key-names json-error-fn: Function to call if JSON serialization fails. Takes a single argument, a Throwable.

Installs json-appender as the sole appender for Timbre, options

`level`:               Timbre log level (deprecated, prefer min-level)
`min-level`:           Timbre log level
`level-key`:           The key to use for log-level
`msg-key`:             The key to use for the message (default :msg)
`pretty`:              Pretty-print JSON
`inline-args?`:        Place arguments on top level, instead of placing behind `args` field
`should-log-field-fn`: A function which determines whether to log the given top-level field.  Defaults to `default-should-log-field-fn`
`ex-data-field-fn`:    A function which pre-processes fields in the ex-info data map. Useful when ex-info data map includes non-Serializable values. Defaults to `default-ex-data-field-fn`
`key-names`:           Map of log key names. Can be used to override the default key names in `default-key-names`
`json-error-fn:`       Function to call if JSON serialization fails. Takes a single argument, a Throwable.
sourceraw docstring

json-appenderclj

(json-appender)
(json-appender {:keys [inline-args?] :or {inline-args? false} :as config})

Creates Timbre configuration map for JSON appender that prints to STDOUT

Creates Timbre configuration map for JSON appender that prints to STDOUT
sourceraw docstring

log-failureclj

(log-failure t request-method uri)
source

log-successclj

(log-success request-method uri status)
source

make-json-output-fnclj

(make-json-output-fn)
(make-json-output-fn {:keys [pretty inline-args? level-key msg-key
                             should-log-field-fn ex-data-field-fn key-names
                             json-error-fn]
                      :or {pretty false
                           inline-args? true
                           should-log-field-fn default-should-log-field-fn
                           ex-data-field-fn default-ex-data-field-fn
                           key-names default-key-names
                           json-error-fn (fn [_t])}})

Creates a Timbre output-fn that prints JSON strings. Takes the following options:

level-key: The key to use for log-level msg-key: The key to use for the message (default :msg) pretty: Pretty-print JSON inline-args?: Place arguments on top level, instead of placing behind args field should-log-field-fn: A function which determines whether to log the given top-level field. Defaults to default-should-log-field-fn ex-data-field-fn: A function which pre-processes fields in the ex-info data map. Useful when ex-info data map includes non-Serializable values. Defaults to default-ex-data-field-fn key-names: Map of log key names. Can be used to override the default key names in default-key-names json-error-fn: Function to call if JSON serialization fails. Takes a single argument, a Throwable.

Creates a Timbre output-fn that prints JSON strings.
Takes the following options:

`level-key`:           The key to use for log-level
`msg-key`:             The key to use for the message (default :msg)
`pretty`:              Pretty-print JSON
`inline-args?`:        Place arguments on top level, instead of placing behind `args` field
`should-log-field-fn`: A function which determines whether to log the given top-level field.  Defaults to `default-should-log-field-fn`
`ex-data-field-fn`:    A function which pre-processes fields in the ex-info data map. Useful when ex-info data map includes non-Serializable values. Defaults to `default-ex-data-field-fn`
`key-names`:           Map of log key names. Can be used to override the default key names in `default-key-names`
`json-error-fn:`       Function to call if JSON serialization fails. Takes a single argument, a Throwable.
sourceraw docstring

object-mapperclj

(object-mapper opts)
source

system-newlineclj

source

wrap-json-loggingclj

(wrap-json-logging handler)

Ring middleware for JSON logging. Logs :method, :uri and :status for successful handler invocations, :method and :uri for failed invocations.

Ring middleware for JSON logging. Logs :method, :uri and :status for successful handler invocations,
:method and :uri for failed invocations.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close