{"id":51509492,"url":"https://github.com/murphsicles/tracing-subscriber","last_synced_at":"2026-07-08T04:30:56.477Z","repository":{"id":362044565,"uuid":"1257002093","full_name":"murphsicles/tracing-subscriber","owner":"murphsicles","description":"Structured tracing subscriber for Zeta","archived":false,"fork":false,"pushed_at":"2026-06-02T09:47:13.000Z","size":115,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-02T11:23:55.730Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/murphsicles.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-02T09:19:28.000Z","updated_at":"2026-06-02T09:47:16.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/murphsicles/tracing-subscriber","commit_stats":null,"previous_names":["murphsicles/tracing-subscriber"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/murphsicles/tracing-subscriber","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murphsicles%2Ftracing-subscriber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murphsicles%2Ftracing-subscriber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murphsicles%2Ftracing-subscriber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murphsicles%2Ftracing-subscriber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/murphsicles","download_url":"https://codeload.github.com/murphsicles/tracing-subscriber/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murphsicles%2Ftracing-subscriber/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35252324,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-08T02:00:06.796Z","response_time":61,"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":[],"created_at":"2026-07-08T04:30:55.918Z","updated_at":"2026-07-08T04:30:56.470Z","avatar_url":"https://github.com/murphsicles.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# @log/tracing-subscriber\n\nA structured tracing subscriber for Zeta, ported from Rust's `tracing-subscriber` crate.\n\nProvides subscriber implementations, filter directives (RUST_LOG-style), ANSI terminal\nformatting, and log-crate compatibility — all without lifetimes or proc-macros.\n\n## Features\n\n- **FmtSubscriber** — drop-in subscriber with builder pattern\n- **EnvFilter** — parse `RUST_LOG` directives (`info`, `crate=debug`, etc.)\n- **Output formats** — Full, Compact, Pretty, and JSON\n- **ANSI styling** — coloured log levels via `nu-ansi-term`\n- **Layer system** — compose multiple subscribers with `Layer` trait + `Stack`\n- **Registry** — track span lifecycles (enter/exit/clone/close)\n- **Log compat** — bridge `log` crate records into tracing\n- **Serde support** — serialize events \u0026 spans to JSON\n- **Custom writers** — stdout, stderr, or custom `FmtWriter`\n\n## Quick Start\n\n```zeta\nuse @log/tracing_subscriber;\n\n// Default subscriber (writes to stdout, INFO level and above)\nFmtSubscriber::builder().init();\n\n// With RUST_LOG-style filtering\nlet filter = EnvFilter::parse(\"my_crate=debug,other=info\");\nFmtSubscriber::builder()\n    .with_env_filter(filter)\n    .init();\n\n// JSON output\nFmtSubscriber::builder()\n    .json()\n    .init();\n\n// Compact format (no target prefix)\nFmtSubscriber::builder()\n    .compact()\n    .init();\n\n// Pretty-printed with ANSI\nFmtSubscriber::builder()\n    .pretty()\n    .init();\n```\n\n## FmtSubscriber Builder\n\n| Method | Description |\n|--------|-------------|\n| `with_target(val)` | Show/hide the target module path |\n| `with_level(val)` | Show/hide the log level |\n| `with_line_number(val)` | Include source line numbers |\n| `with_thread_ids(val)` | Show thread IDs |\n| `with_thread_names(val)` | Show thread names |\n| `json()` | Enable JSON output format |\n| `compact()` | Compact format (no target prefix) |\n| `pretty()` | Pretty-printed format with ANSI |\n| `with_env_filter(filter)` | Apply an `EnvFilter` |\n| `with_max_level(level)` | Set maximum log level |\n| `with_writer(writer)` | Custom output writer |\n| `init()` | Set as global default subscriber |\n\n## EnvFilter\n\nSupports standard `RUST_LOG` syntax:\n\n```zeta\n// Parse from environment (RUST_LOG)\nlet filter = EnvFilter::from_env();\n\n// Parse explicit directives\nlet filter = EnvFilter::parse(\"warn,my_crate=debug,other=error\");\n\n// Build programmatically\nlet filter = EnvFilter::new()\n    .with_directive(\"my_crate\", \"debug\")\n    .with_directive(\"other\", \"error\")\n    .with_default_level(LevelFilter::Warn);\n```\n\n**Directive precedence:** Module-specific directives override the default level.\nIf a target module matches multiple directives, the first match wins.\n\n## Example\n\n```zeta\nuse @log/tracing_subscriber;\nuse @log/tracing::{info, warn, error, debug};\n\nFmtSubscriber::builder()\n    .with_target(true)\n    .with_level(true)\n    .pretty()\n    .init();\n\ninfo!(\"Application started\");\nwarn!(\"Low disk space: {}\", \"85%\");\nerror!(\"Connection refused: {}\", \"192.168.1.1:8080\");\n```\n\nOutput (pretty mode with ANSI):\n```\n2025-01-01T00:00:00Z  INFO my_app: Application started\n2025-01-01T00:00:00Z  WARN my_app: Low disk space: 85%\n2025-01-01T00:00:00Z ERROR my_app: Connection refused: 192.168.1.1:8080\n```\n\n## Log Compatibility\n\nBridge `log` crate records into the tracing system:\n\n```zeta\nuse @log/tracing_subscriber::log_compat::LogTracer;\n\n// Install the log tracer\nLogTracer::init();\n\n// Now all `log` records are dispatched as tracing events\n```\n\n## Serde / JSON\n\nSerialize spans and events to JSON:\n\n```zeta\nuse @log/tracing_subscriber::serde_support;\n\nlet json = serde_support::serialize_event(event);\nlet span_json = serde_support::serialize_span(span_data);\n```\n\n## Layer System\n\nDefine custom layers to intercept span/event lifecycle:\n\n```zeta\npub struct MyLayer;\n\nimpl Layer for MyLayer {\n    fn on_new_span(\u0026mut self, span: SpanData) {\n        // Called when a new span is created\n    }\n    fn on_event(\u0026mut self, event: Event) {\n        // Called for each event\n    }\n    fn on_enter(\u0026mut self, span_id: Id) {\n        // Called when entering a span\n    }\n    fn on_exit(\u0026mut self, span_id: Id) {\n        // Called when exiting a span\n    }\n    fn on_close(\u0026mut self, span_id: Id) {\n        // Called when a span is closed\n    }\n    fn on_event_enabled(\u0026mut self, metadata: Metadata) -\u003e bool {\n        return true;\n    }\n    fn enabled(\u0026mut self, metadata: Metadata) -\u003e bool {\n        return true;\n    }\n}\n```\n\n## Bundled Sub-crates\n\nThis module bundles the following sub-crates as internal modules:\n\n| Module | Description |\n|--------|-------------|\n| `tracing-subscriber` | Core subscriber types and builder |\n| `matchers` | Pattern matching for filter directives |\n| `nu-ansi-term` | ANSI terminal styling |\n| `sharded-slab` | Concurrent slab storage for span data |\n| `thread_local` | Thread-local storage wrapper |\n| `tracing-log` | Log crate compatibility bridge |\n| `tracing-serde` | Serde serialization support |\n\n## License\n\nZeta Standard Library — MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmurphsicles%2Ftracing-subscriber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmurphsicles%2Ftracing-subscriber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmurphsicles%2Ftracing-subscriber/lists"}