Skip to content

district0x expressjs server middleware for logging requests and request errors

License

Notifications You must be signed in to change notification settings

district0x/district-server-middleware-logging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

district0x expressjs server middleware for logging requests and request errors

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published