{"id":22998238,"url":"https://github.com/uswitch/ring-middleware-logging","last_synced_at":"2025-04-02T13:24:00.793Z","repository":{"id":23250442,"uuid":"50039944","full_name":"uswitch/ring-middleware-logging","owner":"uswitch","description":"Ring wrappers to log requests and exception to clojure.tools/logging","archived":false,"fork":false,"pushed_at":"2021-12-15T15:46:58.000Z","size":10,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-02-08T04:29:10.276Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uswitch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-20T15:40:42.000Z","updated_at":"2022-03-01T20:26:35.000Z","dependencies_parsed_at":"2022-07-15T13:47:03.258Z","dependency_job_id":null,"html_url":"https://github.com/uswitch/ring-middleware-logging","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uswitch%2Fring-middleware-logging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uswitch%2Fring-middleware-logging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uswitch%2Fring-middleware-logging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uswitch%2Fring-middleware-logging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uswitch","download_url":"https://codeload.github.com/uswitch/ring-middleware-logging/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246820758,"owners_count":20839296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-15T06:12:16.844Z","updated_at":"2025-04-02T13:24:00.775Z","avatar_url":"https://github.com/uswitch.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ring-middleware-logging\n\nRing wrappers to log requests and exceptions to clojure.tools/logging\n\n## Usage\n\nImport it into your ring project by adding this to your project.clj:\n\n```clojure\n[uswitch/ring-middleware-logging \"0.1.5\"]\n```\n\nYou then only need to add the middleware to your ring handler, e.g:\n```clojure\n(:require [ring-middleware-logging.log-wrappers :as log-wrappers])\n\n(def app\n  (-\u003e #'main-routes\n      api\n      log-wrappers/exception-logging\n      log-wrappers/request-logging\n      ))\n```\n\nNow, requests and exceptions will be nicely logged:\n```clojure\n2016-01-21 14:39:39,797 INFO  energy-fraud-detection.web.log-wrappers:invoke - Completing :get /main.html in 0.2 ms, status 200\n2016-01-21 14:48:18.331 ERROR ring-middleware-logging.log-wrappers  - Exception when handling :get /boom (error id: eef92cb8-45a9-460d-984a-2cb626eb1751)\njava.lang.Exception: boom 3!\n\tat energy_back_office_accrued_revenue_report.handler$fn__8323.invoke(handler.clj:69)\n    ...\n\tat java.lang.Thread.run(Thread.java:745)\nCaused by: java.lang.Exception: original\n\t... 42 more\n2016-01-21 14:48:18.348 INFO  ring-middleware-logging.log-wrappers  - Completing :get /boom in 59.6 ms, status 500\n```\nIn case of an exception, a decently formatted message will be returned to the user as well, \nalong with an error id that can be grepped for in the logs.\n\n## Deployment\n- Manually increment the version number in project.clj\n- drone build will release to internal jars\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuswitch%2Fring-middleware-logging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuswitch%2Fring-middleware-logging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuswitch%2Fring-middleware-logging/lists"}