Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bunyan

Ring middleware to log the http method, url, status code and duration of each request to stdout.

Pull requests are welcome!

Usage

In your project.clj, add the following dependency:

[bunyan "0.1.1"]

Then, add the middleware to your stack.

(ns foo
  (:require [...]
            [org.httpkit.server :refer [run-server]]
            [bunyan.core :as bunyan]))

...

(def app
  (-> (handler/api app-routes)
      (bunyan/wrap-with-logger)))

(defn -main [& args]
  (run-server app {:port config/port}))
  (println (str "Server running on port " config/port))

Example Logs

GET / 200 7ms # 200s are green
GET /redirect 300 7ms # 300s are yellow
POST / 404 0ms # 400s are yellow too
GET /posts 500 1ms # 500s are red

About

A simple logging ring middleware

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages