Appender that sends output to Logentries (https://logentries.com/). Requires Cheshire (https://github.com/dakrone/cheshire).
Appender that sends output to Logentries (https://logentries.com/). Requires Cheshire (https://github.com/dakrone/cheshire).
(clean-key k)
InsightOps only supports alphanumeric values along with @
, $
, _
, and .
in keys. This function
replaces all illegal characters in a string/keyword with a .
. See https://docs.logentries.com/docs/json#section-kvp-parsing-specification for details.
InsightOps only supports alphanumeric values along with `@`, `$`, `_`, and `.` in keys. This function replaces all illegal characters in a string/keyword with a `.`. See https://docs.logentries.com/docs/json#section-kvp-parsing-specification for details.
(data->json-line data user-tags stacktrace-fn)
Create a JSON string to be sent to logentries, will clean keys of illegal characters by applying clean-key
.
N.B. Cheshire only applies :key-fn
to keywords, not strings. So if a key is explicitly a string, then it will be passed through as is.
While we could use clojure.walk to clean up all keys, it's an order of magnitude slower.
Create a JSON string to be sent to logentries, will clean keys of illegal characters by applying `clean-key`. N.B. Cheshire only applies `:key-fn` to keywords, not strings. So if a key is explicitly a string, then it will be passed through as is. While we could use clojure.walk to clean up all keys, it's an order of magnitude slower.
(error-to-stacktrace e)
Create a tersely formatted vector of stack traces. This will show up in a nicely computationally searchable fashion in the json sent to logentries
Create a tersely formatted vector of stack traces. This will show up in a nicely computationally searchable fashion in the json sent to logentries
(logentries-appender token & [opts])
Returns a Logentries appender, which will send each event in JSON format to the
logentries server. If you wish to send additional, custom tags, to logentries on each
logging event, then provide a hash-map in the opts :user-tags
which will be
merged into each event.
This uses com.logentries.net.AsyncLogger, which is the underlying implementation of the log4j and logback appenders from Logentries. That class uses a bounded queue and may drop messages under heavy load. When that happens, it will write error messages to stderr, but only if :debug?
is true
. See https://github.com/rapid7/le_java/blob/master/src/main/java/com/logentries/net/AsyncLogger.java.
If an exception happens during logging, this appender will catch and not rethrow, meeting the standard expectation of a logging library. Exceptions will be logged to stderr at a rate of no more of 1 per minutes per appender. Additional information on the frequency of exxceptions may be found my inspecting the appender (see the fields :call-count
and :error-count
.
Note that cheshire.core
is used to serialize log messages to json. If something in your :user-tags
or :context
is not readily serializable by cheshire
, this will cause exceptions and those messages will not be logged. See https://github.com/dakrone/cheshire#custom-encoders for how to teach chechire
to encode your custom data.
Returns a Logentries appender, which will send each event in JSON format to the logentries server. If you wish to send additional, custom tags, to logentries on each logging event, then provide a hash-map in the opts `:user-tags` which will be merged into each event. This uses com.logentries.net.AsyncLogger, which is the underlying implementation of the log4j and logback appenders from Logentries. That class uses a bounded queue and may drop messages under heavy load. When that happens, it will write error messages to stderr, but only if `:debug?` is `true`. See https://github.com/rapid7/le_java/blob/master/src/main/java/com/logentries/net/AsyncLogger.java. If an exception happens during logging, this appender will catch and not rethrow, meeting the standard expectation of a logging library. Exceptions will be logged to stderr at a rate of no more of 1 per minutes per appender. Additional information on the frequency of exxceptions may be found my inspecting the appender (see the fields `:call-count` and `:error-count`. Note that `cheshire.core` is used to serialize log messages to json. If something in your `:user-tags` or `:context` is not readily serializable by `cheshire`, this will cause exceptions and those messages *will not* be logged. See https://github.com/dakrone/cheshire#custom-encoders for how to teach `chechire` to encode your custom data.
(make-logger {:keys [token debug?]})
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close