{"id":20486365,"url":"https://github.com/oldhammade/logger_ets_backend","last_synced_at":"2026-05-26T23:07:49.495Z","repository":{"id":34931408,"uuid":"191513357","full_name":"OldhamMade/logger_ets_backend","owner":"OldhamMade","description":"A simple Logger backend which writes logs to a named ETS table.","archived":false,"fork":false,"pushed_at":"2023-08-28T15:36:10.000Z","size":31,"stargazers_count":1,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T01:55:31.331Z","etag":null,"topics":["elixir","elixir-lang","logging","logging-backend"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/OldhamMade.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-12T06:43:52.000Z","updated_at":"2022-12-07T21:46:24.000Z","dependencies_parsed_at":"2024-11-15T16:46:37.174Z","dependency_job_id":null,"html_url":"https://github.com/OldhamMade/logger_ets_backend","commit_stats":{"total_commits":4,"total_committers":2,"mean_commits":2.0,"dds":0.5,"last_synced_commit":"35920da4baa9794ecc036ba69834cc9449a7351f"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OldhamMade%2Flogger_ets_backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OldhamMade%2Flogger_ets_backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OldhamMade%2Flogger_ets_backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OldhamMade%2Flogger_ets_backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OldhamMade","download_url":"https://codeload.github.com/OldhamMade/logger_ets_backend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242061463,"owners_count":20065739,"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":["elixir","elixir-lang","logging","logging-backend"],"created_at":"2024-11-15T16:36:09.427Z","updated_at":"2026-05-26T23:07:49.467Z","avatar_url":"https://github.com/OldhamMade.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LoggerEtsBackend\n\n![CI][ci-badge] [![Coverage Status][coverage-badge]][coverage-link]\n\n\u003c!-- MDOC !--\u003e\n\nA simple `Logger` backend which writes log entries to ETS, primarily\nfor runtime inspection.\n\nNote: It does not create or manage the target log table(s) for you; you\nmust do this as part of your own application.\n\n`LoggerEtsBackend` borrows heavily from\n[`LoggerFileBackend`][logger_file_backend], and therefore acts in much\nthe same way.\n\n## Rationale\n\nThe primary use-case for this backend is _not_ for persistent logs,\nbut for temporary logs that need to be inspected at run-time by the\nsystem itself. By pushing log messages to an ETS table, data can be\nquickly searched using `match_spec`s based on message contents or the\nmetadata stored along with the entry.\n\n## Configuration\n\n`LoggerEtsBackend` is a custom backend for the elixir `:logger`\napplication. This backend can only log to a single ETS table, so there\nmust be one `:logger` backend configured for each log file we\nneed. Each backend has a name like `{LoggerEtsBackend, id}`, where\n`id` is any elixir term (usually an atom).\n\n**Note:** tables use for logging are recommented to be configured with\nthe `:ordered_set` and `:public` options.\n\n### Configuration Example\n\n```elixir\nconfig :logger,\n  backends: [{LoggerEtsBackend, :events_log}]\n\n# configuration for the {LoggerEtsBackend, :events_log} backend\nconfig :logger, :events_log,\n  table: :events_log_table,\n  level: :error\n```\n\n## Usage\n\n`LoggerEtsBackend` supports the following configuration values:\n\n* `table` - the table name to push log tuples to\n* `level` - the logging level for the backend\n* `metadata` - the metadata to include\n* `metadata_filter` - metadata terms which must be present in order to\n  log\n\n**Note:** It is recommended that `metadata_filter` is set for this\nbackend, to ensure only a small subset of log entries are captured.\n\n\u003c!-- MDOC !--\u003e\n\n### Examples\n\n#### Runtime configuration\n\n```elixir\n# some process starts an ets table\n:ets.new(:debug_messages, [:ordered_set, :public, :named_table])\n\n# then we configure the backend\nLogger.add_backend {LoggerFileBackend, :debug}\nLogger.configure_backend {LoggerFileBackend, :debug},\n  table: :debug_messages,\n  metadata: ...,\n  metadata_filter: ...\n```\n\n#### Application config for multiple log files\n\n```elixir\nconfig :logger,\n  backends: [{LoggerEtsBackend, :info},\n             {LoggerEtsBackend, :error}]\n\nconfig :logger, :info,\n  table: :info_messages,\n  level: :info\n\nconfig :logger, :error,\n  table: :error_messages,\n  level: :error\n```\n\n#### Filter out metadata\n\nThis example removes all the default metadata and only keeps the\n`:module` name which issued the log message.\n\n```elixir\nconfig :logger,\n  backends: [{LoggerEtsBackend, :info}]\n\nconfig :logger, :info,\n  table: :info_messages,\n  level: :info,\n  metadata: [application: :ui]\n```\n\n#### Filtering logging by specifying metadata terms\n\nThis example only logs `:info` statements originating from the `:ui`\nOTP app. The `:application` metadata key is auto-populated by\n`Logger`.\n\n```elixir\nconfig :logger,\n  backends: [{LoggerEtsBackend, :ui}]\n\nconfig :logger, :ui,\n  table: :ui_messages,\n  level: :info,\n  metadata_filter: [application: :ui]\n```\n\n#### Storing keyword data (Elixir ~\u003e 1.11)\n\nConfiguration:\n\n```elixir\nconfig :logger,\n  backends: [{LoggerEtsBackend, :ui}]\n\nconfig :logger, :ui,\n  table: :ui_messages,\n  level: :info,\n  metadata_filter: [application: :ui]\n```\n\nUsage (example from an `iex -S mix phx.server` instance):\n\n```elixir\niex(1)\u003e require Logger\nLogger\niex(2)\u003e Logger.info([screen: :dashboard, scope: :global], application: :ui)\n:ok\niex(3)\u003e :ets.lookup(:ui_log, :ets.last(:ui_log))\n[\n  {{{2021, 6, 18}, {6, 59, 18, 173}}, :info, [screen: :dashboard, scope: :global],\n   [\n     erl_level: :info,\n     application: :ui,\n     domain: [:elixir],\n     gl: #PID\u003c0.66.0\u003e,\n     pid: #PID\u003c0.1138.0\u003e,\n     time: 1623992358173152\n   ]}\n]\n```\n\n## Contributing\n\n**Note: the project is made \u0026 maintained by a small team of humans,\nwho on occasion may make mistakes and omissions. Please do not\nhesitate to point out if you notice a bug or something missing, and\nconsider contributing if you can.**\n\nThe project is managed on a best-effort basis, and aims to be \"good\nenough\". If there are features missing please raise a ticket or create\na Pull Request by following these steps:\n\n1.  [Fork it][fork]\n2.  Create your feature branch (`git checkout -b my-new-feature`)\n3.  Commit your changes (`git commit -am 'Add some feature'`)\n4.  Push to the branch (`git push origin my-new-feature`)\n5.  Raise a new pull request via GitHub\n\n## Liability\n\nWe take no responsibility for the use of our tool, or external\ninstances provided by third parties. We strongly recommend you abide\nby the valid official regulations in your country. Furthermore, we\nrefuse liability for any inappropriate or malicious use of this\ntool. This tool is provided to you in the spirit of free, open\nsoftware.\n\nYou may view the LICENSE in which this software is provided to you\n[here](./LICENSE).\n\n\u003e 8. Limitation of Liability. In no event and under no legal theory,\n\u003e    whether in tort (including negligence), contract, or otherwise,\n\u003e    unless required by applicable law (such as deliberate and grossly\n\u003e    negligent acts) or agreed to in writing, shall any Contributor be\n\u003e    liable to You for damages, including any direct, indirect, special,\n\u003e    incidental, or consequential damages of any character arising as a\n\u003e    result of this License or out of the use or inability to use the\n\u003e    Work (including but not limited to damages for loss of goodwill,\n\u003e    work stoppage, computer failure or malfunction, or any and all\n\u003e    other commercial damages or losses), even if such Contributor\n\u003e    has been advised of the possibility of such damages.\n\n\n[logger_file_backend]: https://github.com/onkel-dirtus/logger_file_backend\n[ci-badge]: https://github.com/OldhamMade/logger_ets_backend/workflows/CI/badge.svg\n[coverage-badge]: https://coveralls.io/repos/github/OldhamMade/logger_ets_backend/badge.svg?branch=main\n[coverage-link]: https://coveralls.io/github/OldhamMade/logger_ets_backend?branch=main\n[fork]: https://github.com/OldhamMade/logger_ets_backend/fork\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foldhammade%2Flogger_ets_backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foldhammade%2Flogger_ets_backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foldhammade%2Flogger_ets_backend/lists"}