Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vane-tech/ring-json-logger
12 factor app logging in a JSON format for your ring clojure app
https://github.com/vane-tech/ring-json-logger
12-factor clojure json logging logging-library logs ring ring-middleware
Last synced: about 1 month ago
JSON representation
12 factor app logging in a JSON format for your ring clojure app
- Host: GitHub
- URL: https://github.com/vane-tech/ring-json-logger
- Owner: vane-tech
- License: mit
- Created: 2018-06-29T13:59:24.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-29T14:48:10.000Z (over 6 years ago)
- Last Synced: 2024-10-28T13:39:32.337Z (2 months ago)
- Topics: 12-factor, clojure, json, logging, logging-library, logs, ring, ring-middleware
- Language: Clojure
- Size: 60.5 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
![](jason-logger.jpg)
*Jason "Ring" Logger and his colleague at work.*# ring-json-logger
[![Clojars Project](https://img.shields.io/clojars/v/ring-json-logger.svg)](https://clojars.org/ring-json-logger)
![license](https://img.shields.io/github/license/BillFront/ring-json-logger.svg)This is a ring middleware to response time and other details about the requests arriving at your web server in a JSON format to `stdout`.
> A twelve-factor app never concerns itself with routing or storage of its output stream. It should not attempt to write to or manage logfiles. Instead, each running process writes its event stream, unbuffered, to `stdout`.
[The Twelve-Factor App: Logs](https://12factor.net/logs)Example output:
```json
{"method":"get","uri":"/health","query-string":"some=1&query=params","remote-addr":"172.18.0.1","duration":0,"status":200}
{"method":"post","uri":"/customers","query-string":null,"remote-addr":"172.18.0.1","duration":32,"status":500,"exception":"class java.lang.ArithmeticException","exception-message":"Divide by zero"}
```## Usage
```clj
(require '[ring.middleware.json-logger :refer [wrap-json-logger]]); app-routes should be a valid ring application, e.g. routes defined with compojure
(def app (wrap-json-logger app-routes))
```Please note that all query params are logged, so don't submit sensitive data like passwords, tokens, or credit card numbers in the URI. Parameters posted in the request body are not logged at the moment.
## TODO
* Filter sensitive parameters like tokens or passwords
* Log post params
* Config options## Licenses
Copyright © 2018 BillFront GmbH
Distributed under MIT License.