{"id":16058004,"url":"https://github.com/psfried/rust-logging","last_synced_at":"2025-08-04T11:33:57.042Z","repository":{"id":79497307,"uuid":"63297350","full_name":"psFried/rust-logging","owner":"psFried","description":"examples of logging in rust","archived":false,"fork":false,"pushed_at":"2016-07-14T03:47:02.000Z","size":6,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T20:54:12.847Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/psFried.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-07-14T03:01:25.000Z","updated_at":"2024-03-24T23:17:32.000Z","dependencies_parsed_at":"2023-03-12T08:19:43.471Z","dependency_job_id":null,"html_url":"https://github.com/psFried/rust-logging","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/psFried/rust-logging","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psFried%2Frust-logging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psFried%2Frust-logging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psFried%2Frust-logging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psFried%2Frust-logging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/psFried","download_url":"https://codeload.github.com/psFried/rust-logging/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psFried%2Frust-logging/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268689352,"owners_count":24291075,"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-08-04T02:00:09.867Z","response_time":79,"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-09T03:05:51.447Z","updated_at":"2025-08-04T11:33:57.029Z","avatar_url":"https://github.com/psFried.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Logging in Rust\n===============\n\nThis repository is here to provide some examples of logging in Rust. There are two separate rust projects. The first is a basic example using the `env_logger` crate. It is designed to show the basics of how the `log` crate works. The second example, `file-logging` is there to provide an example of working with a more advanced logging backend.\n\n## Basics of logging with Rust\n\n- Use the [log crate](https://crates.io/crates/log)\n    - provides a backend-agnostic logging interface\n    - Really easy to use different backends in different scenarios\n    - defaults to a no-op backend with a really low overhead\n- The [env_logger](https://crates.io/crates/env_logger) crate is _by far_ the most popular logging backend\n    - Just prints to stdout\n    - Can set different log levels by setting the `RUST_LOG` environment variable\n    - Built in filtering of log messages using regex\n    - Can customize the format using a closure to format log messages\n    - Can customize the name of the environment variable that's used for filtering\n    - Best choice for use in tests\n- [log4rs](https://crates.io/crates/log4rs) is a good choice if you need to log to files\n    - Basically a Rust clone of log4j\n    - Configuration can be done either in code or using one of several file formats\n    - Can handle all the crazy logging configurations you're likely to need\n    - Extensible, can write your own appender if you want\n    - The only Rust logging library that has a rolling file appender as far as I can tell\n- [Fern](https://crates.io/crates/fern) is also somewhat popular, but I have not used it myself\n    - Appears nearly on par with lo4rs in terms of features\n    - No commits in over a year :(\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsfried%2Frust-logging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsfried%2Frust-logging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsfried%2Frust-logging/lists"}