{"id":16649499,"url":"https://github.com/rapptz/tracing-appender","last_synced_at":"2026-04-19T16:33:15.797Z","repository":{"id":236178835,"uuid":"792082481","full_name":"Rapptz/tracing-appender","owner":"Rapptz","description":"A fork of tracing-appender","archived":false,"fork":false,"pushed_at":"2024-04-26T00:09:08.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-12T13:24:24.358Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Rapptz.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}},"created_at":"2024-04-26T00:08:42.000Z","updated_at":"2024-04-26T00:09:12.000Z","dependencies_parsed_at":"2024-04-26T01:27:55.339Z","dependency_job_id":"298d360e-6ee8-4c99-ae7b-d612d8a776a2","html_url":"https://github.com/Rapptz/tracing-appender","commit_stats":null,"previous_names":["rapptz/tracing-appender"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Rapptz/tracing-appender","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rapptz%2Ftracing-appender","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rapptz%2Ftracing-appender/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rapptz%2Ftracing-appender/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rapptz%2Ftracing-appender/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rapptz","download_url":"https://codeload.github.com/Rapptz/tracing-appender/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rapptz%2Ftracing-appender/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28056914,"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","status":"online","status_checked_at":"2025-12-26T02:00:06.189Z","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":[],"created_at":"2024-10-12T09:10:40.840Z","updated_at":"2025-12-26T16:50:04.356Z","avatar_url":"https://github.com/Rapptz.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Tracing — Structured, application-level diagnostics][splash]\n\n[splash]: https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/splash.svg\n\n# tracing-appender\n\nWriters for logging events and spans\n\n[![Crates.io][crates-badge]][crates-url]\n[![Documentation][docs-badge]][docs-url]\n[![Documentation (master)][docs-master-badge]][docs-master-url]\n[![MIT licensed][mit-badge]][mit-url]\n[![Build Status][actions-badge]][actions-url]\n[![Discord chat][discord-badge]][discord-url]\n\n[Documentation][docs-url] | [Chat][discord-url]\n\n[crates-badge]: https://img.shields.io/crates/v/tracing-appender.svg\n[crates-url]: https://crates.io/crates/tracing-appender/0.1.1\n[docs-badge]: https://docs.rs/tracing-appender/badge.svg\n[docs-url]: https://docs.rs/tracing-appender/0.1.1\n[docs-master-badge]: https://img.shields.io/badge/docs-master-blue\n[docs-master-url]: https://tracing.rs/tracing-appender\n[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg\n[mit-url]: ../LICENSE\n[actions-badge]: https://github.com/tokio-rs/tracing/workflows/CI/badge.svg\n[actions-url]:https://github.com/tokio-rs/tracing/actions?query=workflow%3ACI\n[discord-badge]: https://img.shields.io/discord/500028886025895936?logo=discord\u0026label=discord\u0026logoColor=white\n[discord-url]: https://discord.gg/EeF3cQw\n\n## Overview\n\n[`tracing`][tracing] is a framework for instrumenting Rust programs to \ncollect structured, event-based diagnostic information. `tracing-appender` \nallows events and spans to be recorded in a non-blocking manner through a \ndedicated logging thread. It also provides a [`RollingFileAppender`][file_appender] \nthat can be used with _or_ without the non-blocking writer.\n\n*Compiler support: [requires `rustc` 1.53+][msrv]*\n\n[msrv]: #supported-rust-versions\n\n## Usage\n\nAdd the following to your `Cargo.toml`:\n```toml\ntracing-appender = \"0.2\"\n```\n\nThis crate can be used in a few ways to record spans/events:\n - Using a [`RollingFileAppender`][file_appender] to write to a log file. \n This is a blocking operation.\n - Using *any* type implementing [`std::io::Write`][write] in a \n non-blocking fashion.\n - Using [`NonBlocking`][non_blocking] and [`RollingFileAppender`][file_appender] \n together to write to log files in a non-blocking fashion.\n\n## Rolling File Appender\n\n```rust\nfn main(){\n    let file_appender = tracing_appender::rolling::hourly(\"/some/directory\", \"prefix.log\");\n}\n```\nThis creates an hourly rotating file appender that writes to \n`/some/directory/prefix.log.YYYY-MM-DD-HH`. [`Rotation::DAILY`] and \n[`Rotation::NEVER`] are the other available options.\n\nThe file appender implements [`std::io::Write`][write]. To be used with \n[`tracing_subscriber::FmtSubscriber`][fmt_subscriber], it must be combined \nwith a [`MakeWriter`][make_writer] implementation to be able to record \ntracing spans/event.\n\nThe [rolling] module's documentation provides more detail on how to use \nthis file appender.\n\n## Non-Blocking Writer\nThe example below demonstrates the construction of a `non_blocking` writer \nwith an implementation of [`std::io::Writer`][write].\n\n```rust\nuse std::io::Error;\n\nstruct TestWriter;\n\nimpl std::io::Write for TestWriter {\n    fn write(\u0026mut self, buf: \u0026[u8]) -\u003e std::io::Result\u003cusize\u003e {\n        let buf_len = buf.len();\n    \n        println!(\"{:?}\", buf);\n        Ok(buf_len)\n    }\n\n    fn flush(\u0026mut self) -\u003e std::io::Result\u003c()\u003e {\n        Ok(())\n    }\n}\n\nfn main() {\n    let (non_blocking, _guard) = tracing_appender::non_blocking(TestWriter);\n    tracing_subscriber::fmt().with_writer(non_blocking).init();\n}\n```\n**Note:** `_guard` is a [`WorkerGuard`][guard] which is returned by \n`tracing_appender::non_blocking` to ensure buffered logs are flushed to \ntheir output in the case of abrupt terminations of a process. See \n[`WorkerGuard`][guard] module for more details.\n\nThe example below demonstrates the construction of a \n[`tracing_appender::non_blocking`][non_blocking] writer constructed with \na [`std::io::Write`][write]:\n\n```rust\nfn main() {\n    let (non_blocking, _guard) = tracing_appender::non_blocking(std::io::stdout());\n    tracing_subscriber::fmt()\n        .with_writer(non_blocking)\n        .init();\n}\n```\n\nThe [non_blocking] module's documentation provides more detail on how to \nuse `non_blocking`.\n\n## Non-Blocking Rolling File Appender\n\n```rust\nfn main() {\n    let file_appender = tracing_appender::rolling::hourly(\"/some/directory\", \"prefix.log\");\n    let (non_blocking, _guard) = tracing_appender::non_blocking(file_appender);\n   tracing_subscriber::fmt()\n       .with_writer(non_blocking)\n       .init();\n}\n```\n\n[tracing]: https://docs.rs/tracing/latest/tracing/\n[make_writer]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/trait.MakeWriter.html\n[write]: https://doc.rust-lang.org/std/io/trait.Write.html\n[non_blocking]: https://docs.rs/tracing-appender/latest/tracing_appender/non_blocking/index.html\n[rolling]: https://docs.rs/tracing-appender/latest/tracing_appender/rolling/index.html\n[guard]: https://docs.rs/tracing-appender/latest/tracing_appender/non_blocking/struct.WorkerGuard.html\n[file_appender]: https://docs.rs/tracing-appender/latest/tracing_appender/rolling/struct.RollingFileAppender.html\n[fmt_subscriber]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/struct.Subscriber.html\n\n## Supported Rust Versions\n\n`tracing-appender` is built against the latest stable release. The minimum supported\nversion is 1.53. The current `tracing-appender` version is not guaranteed to build on\nRust versions earlier than the minimum supported version.\n\nTracing follows the same compiler support policies as the rest of the Tokio\nproject. The current stable Rust compiler and the three most recent minor\nversions before it will always be supported. For example, if the current\nstable compiler version is 1.69, the minimum supported version will not be\nincreased past 1.66, three minor versions prior. Increasing the minimum\nsupported compiler version is not considered a semver breaking change as\nlong as doing so complies with this policy.\n\n## License\n\nThis project is licensed under the [MIT license](../LICENSE).\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in Tokio by you, shall be licensed as MIT, without any additional\nterms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frapptz%2Ftracing-appender","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frapptz%2Ftracing-appender","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frapptz%2Ftracing-appender/lists"}