{"id":18510029,"url":"https://github.com/lfex/logjam","last_synced_at":"2026-03-11T13:20:34.907Z","repository":{"id":26001114,"uuid":"29443602","full_name":"lfex/logjam","owner":"lfex","description":"A custom formatter for the Erlang logger application that produces human-readable output","archived":false,"fork":false,"pushed_at":"2025-11-01T01:06:02.000Z","size":1468,"stargazers_count":13,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"release/1.2.x","last_synced_at":"2026-01-07T19:29:11.466Z","etag":null,"topics":["ansi-colors","erlang","formatter","lfe","logger","logging"],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lfex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-01-18T22:29:52.000Z","updated_at":"2025-11-01T01:06:06.000Z","dependencies_parsed_at":"2023-11-26T08:27:24.994Z","dependency_job_id":"c7fc404f-4c03-4bc9-9824-db34732901db","html_url":"https://github.com/lfex/logjam","commit_stats":{"total_commits":43,"total_committers":4,"mean_commits":10.75,"dds":0.2093023255813954,"last_synced_commit":"b5afb6157b686f40790cffc2e17a3601e29b82c3"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/lfex/logjam","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfex%2Flogjam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfex%2Flogjam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfex%2Flogjam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfex%2Flogjam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lfex","download_url":"https://codeload.github.com/lfex/logjam/tar.gz/refs/heads/release/1.2.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfex%2Flogjam/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30382670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T12:49:11.341Z","status":"ssl_error","status_checked_at":"2026-03-11T12:46:41.342Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ansi-colors","erlang","formatter","lfe","logger","logging"],"created_at":"2024-11-06T15:20:17.179Z","updated_at":"2026-03-11T13:20:34.880Z","avatar_url":"https://github.com/lfex.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# logjam\n\n[![Build Status][gh-actions-badge]][gh-actions]\n[![LFE Versions][lfe-badge]][lfe]\n[![Erlang Versions][erlang-badge]][versions]\n[![Tags][github-tags-badge]][github-tags]\n[![Downloads][hex-downloads]][hex-package]\n\n*A custom formatter for the logger application with LFE logging macros and human-readable output*\n\n[![Project Logo][logo]][logo-large]\n\n## Why?\n\nThe default formatter for Erlang is very difficult to read at a glance making troubleshooting and debugging of applications via log output during development phases rather cumbersome or even difficult.\n\nWith logjam, you get something nice and easy to read:\n\n[![][screenshot]][screenshot]\n\n## About\n\nPrevious versions of logjam wrapped older versions of the lager logging library. As of Erlang 21.0, Erlang has a new (and excellent) logging library, yet the same output is used (and thus the same problems regarding developer readability persist). The [flatlog][flatlog] library was created to provide structured logging support for the new logger library, and this project was used as the basis of logjam 1.0. Logjam provides additional configuration on top of the code inherited from flatlog, and while it does support much of the same structured logging that flatlog provides, its goals are completely different.\n\nFor versions of Erlang older than 21.0 (and for LFE 1.2), you may be able to use the [0.6.0 release](https://github.com/lfex/logjam/releases/tag/0.6.0) of logjam.\n\n## Usage\n\nThere are two ways to use logjam:\n\n1. Simply as a formatter, in which case it should be to the release apps and not included as a dependency. This assumes you will be using the logger macros included with Erlang/OTP.\n1. As both a formatter as well as taking advantage of the logjam logging macros that have Lisp-style names (e.g., `log-debug`). In this case, you will want to include logjam as a dependency.\n\n### Configuration\n\nOnce the project is added, replace the formatter of the default handler (or add a custom handler) for structured logging to your `sys.config` file:\n\n```erlang\n[\n  {kernel, [\n      {logger, [\n          {handler, default, logger_std_h,\n          #{level =\u003e info,\n            formatter =\u003e {logjam,\n              #{colored =\u003e true,\n                time_designator =\u003e $\\s,\n                time_offset =\u003e \"\",\n                time_unit =\u003e second,\n                strip_tz =\u003e true,\n                level_capitalize =\u003e true\n              }\n            }\n           }\n          }\n      ]}\n  ]}\n].\n```\n\nThis configuration was used to produce the screenshot above.\n\nNote that if you are building a release, you will need to manually add\nthe `logjam` dependency to your `relx` configuration, since it is\ntechnically not a direct dependency of any application in your system.\n\nIf you're not using an OTP release and just want to set up logging based upon a config file with the above entry in it, you can do the following:\n\n```lisp\n(logjam:set-config #(path \"./path/to/thing.config\"))\n```\n\nThis is what is done in `./scripts/demo.lfe`.\n\nIf you have the config data already in above format (proplist with a `kernel` entry), you can just do this:\n\n```lisp\n(logjam:set-config config-data)\n```\n\n### Logging Calls\n\nIf you call the logger functions directly, your log output will not have reference to the module, function, arity, or line number where the logging call was made. For this info, you need to use the `logger` or `logjam` macros.\n\nInclude the `logger` calls with either:\n\n```lisp\n(include-lib \"kernel/include/logger.hrl\")\n```\n\nor\n\n```erlang\n-include_lib(\"kernel/include/logger.hrl\").\n```\n\nThis will let you call the logging macros such as `(LOG_DEBUG \"my message\")` or `?LOG_DEBUG(\"my message\").`\n\nIf you'd like to use the `logjam` macros, use these instead:\n\n```lisp\n(include-lib \"logjam/include/logjam.hrl\")\n```\n\nor\n\n```erlang\n-include_lib(\"logjam/include/logjam.hrl\").\n```\n\nThis will let you call the logging macros such as `(log-debug \"my message\")` or `?'log-debug'(\"my message\").`\n\nHere is some example LFE usage:\n\n```lisp\n(log-debug \"This is a debug-level message\")\n(log-info \"This is an info-level message\")\n(log-notice \"This is a notice-level message\")\n(log-warn \"This is a warning-level message\")\n(log-error \"This is an error-level message\")\n(log-crit \"This is a critical-level message\")\n(log-alert \"This is an alert-level message\")\n(log-emergency \"This is an emergency-level message\")\n(log-info #m(some \"structured\" logging \"examples\" might \"be useful too\")))\n```\n\n## Demo\n\n``` bash\nrebar3 demo\n```\n\n## Test\n\n```bash\nrebar3 check\n```\n\n[//]: ---Named-Links---\n\n[logo]: priv/images/logjam-crop-small.png\n[logo-large]: priv/images/logjam.jpg\n[screenshot]: priv/images/screenshot.png\n[gh-actions-badge]: https://github.com/lfex/logjam/workflows/ci%2Fcd/badge.svg\n[gh-actions]: https://github.com/lfex/logjam/actions\n[lfe]: https://github.com/rvirding/lfe\n[lfe-badge]: https://img.shields.io/badge/lfe-2.1+-blue.svg\n[erlang-badge]: https://img.shields.io/badge/erlang-21%20to%2025-blue.svg\n[versions]: https://github.com/lfex/logjam/blob/master/.travis.yml\n[github-tags]: https://github.com/lfex/logjam/tags\n[github-tags-badge]: https://img.shields.io/github/tag/lfex/logjam.svg\n[github-downloads]: https://img.shields.io/github/downloads/lfex/logjam/total.svg\n[flatlog]: https://github.com/ferd/flatlog\n[hex-badge]: https://img.shields.io/hexpm/v/logjam.svg?maxAge=2592000\n[hex-package]: https://hex.pm/packages/logjam\n[hex-downloads]: https://img.shields.io/hexpm/dt/logjam.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flfex%2Flogjam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flfex%2Flogjam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flfex%2Flogjam/lists"}