(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}} ```
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
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
(json-req req)
A json request format, which converts the request to json.
A json request format, which converts the request to json.
(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.
(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.
(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.
A basic configuration for wrap-logging, when receiving requests, usually via ring.
A basic configuration for wrap-logging, when receiving requests, usually via ring.
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.
(structured-req req)
A map request format, which returns structured data
A map request format, which returns structured data
(structured-resp req resp)
A map response format, which returns structured data
A map response format, which returns structured data
(trace)
Returns a 4 character string of random alphanumeric characters
Returns a 4 character string of random alphanumeric characters
(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.
(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.
(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.
(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.
(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.
(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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close