{"id":17288419,"url":"https://github.com/rymndhng/logfmt","last_synced_at":"2025-09-19T01:17:56.999Z","repository":{"id":57717391,"uuid":"268131361","full_name":"rymndhng/logfmt","owner":"rymndhng","description":"logfmt for clojure","archived":false,"fork":false,"pushed_at":"2020-05-30T18:00:36.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-20T10:11:27.856Z","etag":null,"topics":["clojure","logfmt"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rymndhng.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-30T17:48:25.000Z","updated_at":"2020-05-30T18:01:34.000Z","dependencies_parsed_at":"2022-09-05T20:12:02.032Z","dependency_job_id":null,"html_url":"https://github.com/rymndhng/logfmt","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rymndhng%2Flogfmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rymndhng%2Flogfmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rymndhng%2Flogfmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rymndhng%2Flogfmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rymndhng","download_url":"https://codeload.github.com/rymndhng/logfmt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245706991,"owners_count":20659483,"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":["clojure","logfmt"],"created_at":"2024-10-15T10:27:54.925Z","updated_at":"2025-09-19T01:17:51.956Z","avatar_url":"https://github.com/rymndhng.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# logfmt\n\n[![Clojars Project](https://img.shields.io/clojars/v/rymndhng/logfmt.svg)](https://clojars.org/rymndhng/logfmt)\n\nGenerates logfmt encoded strings in Clojure.\n\n## Why\n\n`logfmt` is a nice middle point between unstructructed \u0026 structured data for\nhumans to read \u0026 execute adhoc log analysis.\n\nSee https://brandur.org/canonical-log-lines\n\n## Usage\n\nBasic Usage to Generate Strings\n\n``` clojure\n(require '[rymndhng.logfmt :as logfmt])\n\n;; encoding maps\n(logfmt/encode {:foo \"bar\"})\n\"foo=bar\"\n\n(logfmt/encode {:msg \"hello world!\"})\n\"msg=\\\"hello world!\\\"\"\n\n;; encoding keyvalue pairs (to preserve ordering)\n(logfmt/encode-keyvals :foo \"bar\" :baz \"qux\")\n\"foo=bar baz=qux\"\n```\n\n## Integration with Logging Frameworks\n\n`logfmt` is lightweight and is easily embedded inside your existing logging\nsolution.\n\n```\n(require '[rymndhng.logfmt :as logfmt])\n(require '[clojure.tools.logging :as log])\n\n(log/info (logfmt/encode-keyvals :msg \"processed message\" :time 500))\n```\n\nIf you use `timbre`, there is an optional module to output logs in `logfmt`.\n\n```clojure\n(require '[taoensso.timbre :as timbre])\n(require 'rymndhng.logfmt.timbre)\n\n(timbre/merge-config! {:output-fn rymndhng.logfmt.timbre/logfmt-output-fn})\n\n(timbre/warn \"hello\")\n;\u003e level=warn time=\"20-05-30 17:18:23\" ns=user:156 msg=hello\n\n(timbre/with-context {:id 12345}\n  (timbre/warn \"hello\"))\n;\u003e level=warn time=\"20-05-30 17:19:56\" ns=user:168 msg=hello id=12345\n\n(let [ex (ex-info \"uh-oh\" {:user-id 123})]\n  (timbre/warn ex \"failed to handle command\"))\n;\u003e level=warn time=\"20-05-30 17:21:53\" ns=user:173 msg=\"failed to handle command\"  error_class=clojure.lang.ExceptionInfo error_message=uh-oh\n\n\n;; Configure output-fn to emit ex-data. Use with caution!\n(timbre/merge-config! {:output-fn (partial rymndhng.logfmt.timbre/logfmt-output-fn {:ex-data? true})})\n\n(let [ex (ex-info \"uh-oh\" {:user-id 123})]\n  (timbre/warn ex \"uhoh\"))\n;\u003e level=warn time=\"20-05-30 17:39:38\" ns=user:323 msg=uhoh error_class=clojure.lang.ExceptionInfo error_message=uh-oh user-id=123\n```\n\n## License\n\nCopyright © 2020 Raymond Huang\n\nThis program and the accompanying materials are made available under the\nterms of the Eclipse Public License 2.0 which is available at\nhttp://www.eclipse.org/legal/epl-2.0.\n\nThis Source Code may also be made available under the following Secondary\nLicenses when the conditions for such availability set forth in the Eclipse\nPublic License, v. 2.0 are satisfied: GNU General Public License as published by\nthe Free Software Foundation, either version 2 of the License, or (at your\noption) any later version, with the GNU Classpath Exception which is available\nat https://www.gnu.org/software/classpath/license.html.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frymndhng%2Flogfmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frymndhng%2Flogfmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frymndhng%2Flogfmt/lists"}