Liking cljdoc? Tell your friends :D

district-server-middleware-logging

Simple Clojurescript express.js server middleware for logging requests and request errors. It uses timbre as a logging library. This middleware is meant to be plugged into other district0x expressjs server modules.

Installation

Add
Clojars Project
into your project.clj
Include [district.server.middleware.logging] in your CLJS file

Usage

Here's example how to use with district-server-graphql server.

(ns my-district
    (:require [mount.core :as mount]
              [district.server.graphql]
              [district.server.middleware.logging :refer [logging-middlewares]]))

  (def schema "type Query { hello: String}")
  (def root {:hello (constantly "Hello world")})

  (-> (mount/with-args
        {:graphql {:port 6200
                   :path "/graphql"
                   :schema schema
                   :root-value root
                   :middlewares [logging-middlewares] ;; This installs middleware into the server
                   }})
    (mount/start))

That's it! Now the server will log each request and request error, according to how you had set up your timbre. For easy timbre setup see district-server-logging.

Can you improve this documentation? These fine people already did:
ginesdt & madvas
Edit on GitHub

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

× close