{"id":20398064,"url":"https://github.com/zgbjgg/legolas","last_synced_at":"2026-04-19T02:32:52.450Z","repository":{"id":146695669,"uuid":"323448533","full_name":"zgbjgg/legolas","owner":"zgbjgg","description":"Legolas - A process message interceptor for debugging purposes","archived":false,"fork":false,"pushed_at":"2021-01-27T17:18:50.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-07T09:51:29.767Z","etag":null,"topics":["debug","debugging","elixir","erlang","intercept-messages"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zgbjgg.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":"2020-12-21T21:10:11.000Z","updated_at":"2025-04-29T00:02:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"bc0879b6-868e-4520-a963-b10054bb2c8a","html_url":"https://github.com/zgbjgg/legolas","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zgbjgg/legolas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgbjgg%2Flegolas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgbjgg%2Flegolas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgbjgg%2Flegolas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgbjgg%2Flegolas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zgbjgg","download_url":"https://codeload.github.com/zgbjgg/legolas/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgbjgg%2Flegolas/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31991986,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["debug","debugging","elixir","erlang","intercept-messages"],"created_at":"2024-11-15T04:18:07.757Z","updated_at":"2026-04-19T02:32:52.408Z","avatar_url":"https://github.com/zgbjgg.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Legolas \u003e\u003e\u003e---\u003e\n\nLegolas is a process message interceptor for debugging purposes, under the hood\nit uses `dbg` to trace calls over a single process. All received messages to the process\nare intercepted and sent to the designed collectors processes.\n\n## Adding targets\n\nIn order to start, first add a target process (pid) to intercept messages.\n\n```elixir\n    iex(1)\u003e Legolas.add_target self\n    :ok\n```\n\nThe above code will intercept all messages sent to the `self` process.\n\n## Adding collectors\n\nA collector is a process (pid) that will receive all messages intercepted in the target processes.\n\n```elixir\n    iex(2)\u003e Legolas.add_collector self\n```\n\nIn the above code `self` will receive all messages sent to targets processes.\n\n## Adding structs\n\nStructs is a main patter to intercept messages and filter with that pattern. Add multiple structs into Legolas:\n\n```elixir\n    iex(3)\u003e Legolas.add_struct Middle.Earth.Orc\n```\n\n## Legolas in action\n\nNow send a message to the target process and check how the collectors will receive the same message.\n\n@TODO: We need to support to handle multiple pattern matching for messages, for now Legolas supports to intercept\nmessages with a defined struct (defstruct).\n\n```elixir\n    iex(4)\u003e send self, %Middle.Earth.Orc{}\n    %Middle.Earth.Orc{name: \"Azog\"}\n    iex(5)\u003e flush()\n    %Middle.Earth.Orc{name: \"Azog\"}\n    {:message, %Middle.Earth.Orc{name: \"Azog\"}}\n    :ok\n```\n\nWhen intercept a new message, the collector process receive the message same as target process and emits a log.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzgbjgg%2Flegolas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzgbjgg%2Flegolas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzgbjgg%2Flegolas/lists"}