{"id":15563928,"url":"https://github.com/mrsarm/rust-actix-contrib-logger","last_synced_at":"2026-03-11T22:41:43.002Z","repository":{"id":188252145,"uuid":"677924959","full_name":"mrsarm/rust-actix-contrib-logger","owner":"mrsarm","description":"Drop-in replacement for the Actix Web HTTP Logger middleware","archived":false,"fork":false,"pushed_at":"2024-08-07T11:56:21.000Z","size":28,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-13T09:40:42.722Z","etag":null,"topics":["actix-web","log","logger","logging","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/actix-contrib-logger","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrsarm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2023-08-13T05:13:54.000Z","updated_at":"2024-08-07T11:56:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"4c1db529-d8f8-428e-ba38-a6ff381d9cfe","html_url":"https://github.com/mrsarm/rust-actix-contrib-logger","commit_stats":null,"previous_names":["mrsarm/rust-actix-contrib-logger"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mrsarm/rust-actix-contrib-logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsarm%2Frust-actix-contrib-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsarm%2Frust-actix-contrib-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsarm%2Frust-actix-contrib-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsarm%2Frust-actix-contrib-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrsarm","download_url":"https://codeload.github.com/mrsarm/rust-actix-contrib-logger/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsarm%2Frust-actix-contrib-logger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30405619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T22:36:59.286Z","status":"ssl_error","status_checked_at":"2026-03-11T22:36:57.544Z","response_time":84,"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":["actix-web","log","logger","logging","rust"],"created_at":"2024-10-02T16:30:38.478Z","updated_at":"2026-03-11T22:41:42.978Z","avatar_url":"https://github.com/mrsarm.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"actix-contrib-logger\n====================\n\nLogger middleware for the [Actix Web framework](https://actix.rs/).\n\nActually it's a _copy \u0026 paste_ from the official [Logger](https://actix.rs/docs/middleware/#logging)\nmiddleware (original [source code](https://github.com/actix/actix-web/blob/master/actix-web/src/middleware/logger.rs)),\nbut it allows to choose the logging level depending on the HTTP status code responded,\n(see [`Logger::custom_level()`](https://docs.rs/actix-contrib-logger/latest/actix_contrib_logger/middleware/struct.Logger.html#method.custom_level)\nand [`Logger::custom_error_resp_level()`](https://docs.rs/actix-contrib-logger/latest/actix_contrib_logger/middleware/struct.Logger.html#method.custom_error_resp_level))\nand by default server errors are logged with `ERROR` level.\n\nMoreover, error in response logs are also configurable, and by default logged as `ERROR`\nfor server side failures.\n\nThe Logger middleware uses the standard log crate to log information. You should enable logger for\nthe `http_logger` to see access logs ([`env_logger`](https://docs.rs/env_logger) or similar).\n\n### Examples\n\nIn the following example `ERROR` level is used for server errors, `WARN` for\nHTTP 404 responses (_Not Found_), and for the rest `INFO` level:\n\n```rust\nuse actix_contrib_logger::middleware::Logger;\nuse env_logger::Env;\nuse http::StatusCode;\nuse log::Level;\n\n#[actix_web::main]\nasync fn main() -\u003e std::io::Result\u003c()\u003e {\n    use actix_web::{App, HttpServer};\n\n    env_logger::init_from_env(Env::default().default_filter_or(\"info\"));\n\n    HttpServer::new(|| {\n        let logger = Logger::default()\n            .custom_level(|status| {\n                if status.is_server_error() {\n                    Level::Error\n                } else if status == StatusCode::NOT_FOUND {\n                    Level::Warn\n                } else {\n                    Level::Info\n                }\n            });\n        App::new().wrap(logger)\n    })\n        .bind((\"127.0.0.1\", 8080))?\n        .run()\n        .await\n}\n```\n\nRequests logs will look like:\n\n```\n[2023-08-13T07:28:00Z INFO  http_logger] 127.0.0.1 \"GET / HTTP/1.1\" 200 802 \"-\" \"Mozilla/5.0 ...\" 0.001985\n[2023-08-13T07:29:10Z ERROR http_logger] 127.0.0.1 \"POST /users HTTP/1.1\" 500 86 \"-\" \"curl/7.68.0\" 0.002023\n[2023-08-13T07:29:10Z WARN  http_logger] 127.0.0.1 \"PUT /users HTTP/1.1\" 404 55 \"-\" \"HTTPie/3.2.1\" 0.002023\n```\n\nUsing the method [`logger.custom_error_resp_level()`](https://docs.rs/actix-contrib-logger/latest/actix_contrib_logger/middleware/struct.Logger.html#method.custom_error_resp_level)\nthe log level of error in responses are also configurable, otherwise by default like the original\nlogger all are printed in `DEBUG` level, except for server errors that are printed out in `ERROR` level.\nThe log also includes the HTTP status information (original logger doesn't). E.g.:\n\n```\n[2023-08-13T20:59:53Z ERROR http_logger] Error in \"500 Internal Server Error\" response: DB(PoolTimedOut)\n```\n\n### About\n\n**Project Home**: https://github.com/mrsarm/rust-actix-contrib-logger.\n\n#### Authors\n\n- Original Authors: The Actix Project created the original `logger` module. \n- Modifications in this project: Mariano Ruiz (mrsarm at gmail.com).\n\n## License\n\nThis project is licensed under either of the following licenses, at your option:\n\n- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or [http://www.apache.org/licenses/LICENSE-2.0])\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or [http://opensource.org/licenses/MIT])\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrsarm%2Frust-actix-contrib-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrsarm%2Frust-actix-contrib-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrsarm%2Frust-actix-contrib-logger/lists"}