Liking cljdoc? Tell your friends :D

ring-logging.core


deep-select-keysclj/s

(deep-select-keys m x)

A utility function for filtering requests and responses. Behaves like select-keys, but with arbitrary nesting. When a value is missing in the source map, it will not be included in the result. For example:

(deep-select-keys
  {:method       :get
   :url          "http://google.com"
   :query-params {:a        "some"
                  :password "safe"}
   :headers      {"Authentication" "safe"}} [:method :url :form-params {:query-params [:a :b]}])

; =>
  {:method       :get
   :url          "http://google.com"
   :query-params {:a "some"}}

And

(deep-select-keys
  {:status  302
   :headers {"Location"     "http://elsewhere.com"
             "Authencation" "safe"}
   :body    {:number 25
             :key    :xyz}}
  [:status {:headers "Location"
            :body    :number}])

; =>
  {:status  302
   :headers {"Location" "http://elsewhere.com"}
   :body    {:number 25}}
A utility function for filtering requests and responses.  Behaves
like select-keys, but with arbitrary nesting. When a value is missing
in the source map, it will not be included in the result.  For
example:

``` clojure
(deep-select-keys
  {:method       :get
   :url          "http://google.com"
   :query-params {:a        "some"
                  :password "safe"}
   :headers      {"Authentication" "safe"}} [:method :url :form-params {:query-params [:a :b]}])

; =>
  {:method       :get
   :url          "http://google.com"
   :query-params {:a "some"}}
```

And

``` clojure
(deep-select-keys
  {:status  302
   :headers {"Location"     "http://elsewhere.com"
             "Authencation" "safe"}
   :body    {:number 25
             :key    :xyz}}
  [:status {:headers "Location"
            :body    :number}])

; =>
  {:status  302
   :headers {"Location" "http://elsewhere.com"}
   :body    {:number 25}}
```
sourceraw docstring

default-censor-keysclj/s

source

expclj/s

(exp x n)
source

extend-traceclj/s

(extend-trace prior)
source

json-inbound-configclj/s

A basic configuration for wrap-logging, when receiving requests, usually via ring. Logs as json

A basic configuration for wrap-logging, when receiving requests,
usually via ring. Logs as json
sourceraw docstring

json-outbound-configclj/s

A basic configuration for wrap-logging, when making outbound requests to other services, usually via clj-http/client. Logs as json

A basic configuration for wrap-logging, when making outbound
requests to other services, usually via clj-http/client. Logs as json
sourceraw docstring

json-reqclj/s

(json-req req)

A json request format, which converts the request to json.

A json request format, which converts the request to json.
sourceraw docstring

json-respclj/s

(json-resp req resp)

A json response format, which converts the resp and the req to json.

A json response format, which converts the resp and the req to json.
sourceraw docstring

max-trace-optsclj/s

source

pr-reqclj/s

(pr-req req)

A basic request format, which just uses pr-str on the request.

A basic request format, which just uses pr-str on the request.
sourceraw docstring

pr-respclj/s

(pr-resp req resp)

A basic response format, which just uses pr-str on the request and response.

A basic response format, which just uses pr-str on the request and response.
sourceraw docstring

simple-inbound-configclj/s

A basic configuration for wrap-logging, when receiving requests, usually via ring.

A basic configuration for wrap-logging, when receiving requests,
usually via ring.
sourceraw docstring

simple-outbound-configclj/s

A basic configuration for wrap-logging, when making outbound requests to other services, usually via clj-http/client.

A basic configuration for wrap-logging, when making outbound
requests to other services, usually via clj-http/client.
sourceraw docstring

structured-inbound-configclj/s

source

structured-outbound-configclj/s

source

structured-output-configclj/s

source

structured-reqclj/s

(structured-req req)

A map request format, which returns structured data

A map request format, which returns structured data
sourceraw docstring

structured-respclj/s

(structured-resp req resp)

A map response format, which returns structured data

A map response format, which returns structured data
sourceraw docstring

to-jsonclj/s

(to-json value)
source

traceclj/s

(trace)

Returns a 4 character string of random alphanumeric characters

Returns a 4 character string of random alphanumeric characters
sourceraw docstring

trace-lengthclj/s

source

trace-paddingclj/s

source

trace-radixclj/s

source

txfm-inbound-reqclj/s

(txfm-inbound-req req)

A basic tranformation for requests this service receives and processes, usually via ring. Includes request-method, uri, params, remote-addr and the host and request-trace headers.

A basic tranformation for requests this service receives and
processes, usually via ring. Includes request-method, uri, params,
remote-addr and the host and request-trace headers.
sourceraw docstring

txfm-outbound-reqclj/s

(txfm-outbound-req req)

A basic tranformation for requests this service makes to other services, usually via clj-http/client. Includes method, url, query-params, form-params, and the request-trace header.

A basic tranformation for requests this service makes to other
services, usually via clj-http/client. Includes method, url,
query-params, form-params, and the request-trace header.
sourceraw docstring

txfm-respclj/s

(txfm-resp resp)

A basic response tranformation. Includes response status, request-time and the Location header for redirects.

A basic response tranformation.  Includes response status,
request-time and the Location header for redirects.
sourceraw docstring

wrap-loggingclj/s

(wrap-logging handler logger)
(wrap-logging handler
              logger
              {:keys [censor-keys txfm-req format-req txfm-resp format-resp]
               :or {censor-keys #{}
                    txfm-req identity
                    format-req pr-req
                    txfm-resp identity
                    format-resp pr-resp}})

Middleware that logs at the start of the request and the end of the response. Accepts optional configuration parameters: :param: censor-keys A set of keys, which if they match (lower-case contain), will appear in the log but whose values will be redacted. Default: #{}. :param: txfm-req A function which will transform the request before it is formatted. Useful for filtering sensitive information from the request. Default: identity. :param: format-req A function which will format the request. Default: pr-req :param: txfm-resp A function which will transform the response before it is formatted. Useful for selecting a small piece of the response to be logged, possibly in combination with pr-resp. Default: identity. :param: format-resp A function which will format the response. Receives both the request and response as arguments. Default: pr-resp.

Middleware that logs at the start of the request and the end of the response.
Accepts optional configuration parameters:
:param: censor-keys  A set of keys, which if they match (lower-case contain), will
                     appear in the log but whose values will be redacted.
                     Default: #{}.
:param: txfm-req     A function which will transform the request before it is
                     formatted. Useful for filtering sensitive information from the
                     request. Default: identity.
:param: format-req   A function which will format the request. Default: pr-req
:param: txfm-resp    A function which will transform the response before it is
                     formatted. Useful for selecting a small piece of the response
                     to be logged, possibly in combination with pr-resp. Default:
                     identity.
:param: format-resp  A function which will format the response. Receives both the
                     request and response as arguments. Default: pr-resp.
sourceraw docstring

wrap-request-timingclj/s

(wrap-request-timing handler)

Middleware that times the request, putting the total time (in milliseconds) of the request into the :request-time key in the response. This is part of default-middleware in clj-http.client, so it doesn't always need to be added. Extends the response so must execute later than wrap-logging.

Middleware that times the request, putting the total time (in
milliseconds) of the request into the :request-time key in the
response. This is part of default-middleware in clj-http.client, so
it doesn't always need to be added. Extends the response so must
execute later than wrap-logging.
sourceraw docstring

wrap-trace-requestclj/s

(wrap-trace-request handler)
(wrap-trace-request handler {:keys [keyseq]})

Middleware that adds an id (4 hex digits) into the request, at the provided key, as by assoc-in, by default at [:headers "request-trace"]. If an id is already present, extends it so that '6d3d' becomes '6d3d.ef66'. The recommended usage is to pass traces from one service to another, so that a log aggregator can follow requests between the services. Extends the request, so must execute earlier than wrap-logging.

Middleware that adds an id (4 hex digits) into the request, at the
provided key, as by assoc-in, by default at [:headers
"request-trace"]. If an id is already present, extends it so that
'6d3d' becomes '6d3d.ef66'. The recommended usage is to pass traces
from one service to another, so that a log aggregator can follow
requests between the services. Extends the request, so must execute
earlier than wrap-logging.
sourceraw docstring

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

× close