{"id":27062525,"url":"https://github.com/cmackenzie1/tracing-ndjson","last_synced_at":"2026-02-09T13:31:43.887Z","repository":{"id":198984804,"uuid":"701834458","full_name":"cmackenzie1/tracing-ndjson","owner":"cmackenzie1","description":"A customizable NDJSON format for tracing in Rust.","archived":false,"fork":false,"pushed_at":"2025-08-15T20:47:03.000Z","size":29,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-25T19:56:13.746Z","etag":null,"topics":["hacktoberfest","json","rust","tracing","tracing-subscriber"],"latest_commit_sha":null,"homepage":"https://docs.rs/tracing-ndjson","language":"Rust","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/cmackenzie1.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}},"created_at":"2023-10-07T17:38:38.000Z","updated_at":"2025-08-15T20:47:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"45ca94bb-bfda-463e-8409-d63b6c2092dd","html_url":"https://github.com/cmackenzie1/tracing-ndjson","commit_stats":null,"previous_names":["cmackenzie1/tracing-ndjson"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/cmackenzie1/tracing-ndjson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmackenzie1%2Ftracing-ndjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmackenzie1%2Ftracing-ndjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmackenzie1%2Ftracing-ndjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmackenzie1%2Ftracing-ndjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cmackenzie1","download_url":"https://codeload.github.com/cmackenzie1/tracing-ndjson/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmackenzie1%2Ftracing-ndjson/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29266919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T12:53:16.161Z","status":"ssl_error","status_checked_at":"2026-02-09T12:52:30.244Z","response_time":56,"last_error":"SSL_read: 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":["hacktoberfest","json","rust","tracing","tracing-subscriber"],"created_at":"2025-04-05T15:17:35.209Z","updated_at":"2026-02-09T13:31:43.869Z","avatar_url":"https://github.com/cmackenzie1.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tracing-ndjson\n\n[![Crates.io](https://img.shields.io/crates/v/tracing-ndjson)](https://crates.io/crates/tracing-ndjson)\n[![Rust](https://github.com/cmackenzie1/tracing-ndjson/actions/workflows/rust.yml/badge.svg)](https://github.com/cmackenzie1/tracing-ndjson/actions/workflows/rust.yml)\n[![docs.rs](https://img.shields.io/docsrs/tracing-ndjson)](https://docs.rs/tracing-ndjson/latest/tracing_ndjson)\n\nA simple library for tracing in new-line delimited JSON format. This library is meant to be used with [tracing](https://github.com/tokio-rs/tracing) as an alternative to the `tracing_subscriber::fmt::json` formatter.\n\nThe goal of this crate is to provide a flattend JSON event, comprising of fields from the span attributes and event fields, with customizeable field names and timestamp formats.\n\n## Features\n\n- Configurable field names for `target`, `message`, `level`, and `timestamp`.\n- Configurable timestamp formats\n  - RFC3339 (`2023-10-08T03:30:52Z`),\n  - RFC339Nanos (`2023-10-08T03:30:52.123456789Z`)\n  - Unix timestamp (`1672535452`)\n  - UnixMills (`1672535452123`)\n- Captures all span attributes and event fields in the root of the JSON object. Collisions will result in overwriting the existing field.\n\n## Limitations\n\n- When flattening span attributes and event fields, the library will overwrite any existing fields with the same name, including the built-in fields such as `target`, `message`, `level`, `timestamp`, `file`, and `line`.\n- Non-determistic ordering of fields in the JSON object. ([JSON objects are unordered](https://www.json.org/json-en.html))\n- Currently only logs to stdout. (PRs welcome!)\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\ntracing = \"0.1\"\ntracing-ndjson = \"0.2\"\n```\n\n```rust\nuse tracing_subscriber::prelude::*;\n\nfn main() {\n    let subscriber = tracing_subscriber::registry().with(tracing_ndjson::layer());\n\n    tracing::subscriber::set_global_default(subscriber).unwrap();\n\n    tracing::info!(life = 42, \"Hello, world!\");\n    // {\"level\":\"info\",\"target\":\"default\",\"life\":42,\"timestamp\":\"2023-10-20T21:17:49Z\",\"message\":\"Hello, world!\"}\n\n    let span = tracing::info_span!(\"hello\", \"request.uri\" = \"https://example.com\");\n    span.in_scope(|| {\n        tracing::info!(\"Hello, world!\");\n        // {\"message\":\"Hello, world!\",\"request.uri\":\"https://example.com\",\"level\":\"info\",\"target\":\"default\",\"timestamp\":\"2023-10-20T21:17:49Z\"}\n    });\n}\n```\n\n### Examples\n\nSee the [examples](./examples) directory for more examples.\n\n## License\n\nLicensed under [MIT license](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmackenzie1%2Ftracing-ndjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcmackenzie1%2Ftracing-ndjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmackenzie1%2Ftracing-ndjson/lists"}