{"id":18394401,"url":"https://github.com/romac/rocket-slog-fairing","last_synced_at":"2026-06-29T12:31:37.747Z","repository":{"id":66930134,"uuid":"188058093","full_name":"romac/rocket-slog-fairing","owner":"romac","description":"Fairing that you can attach to your rocket.rs application to enable use of a slog Logger in your handlers.                   Fork of https://gitlab.com/pwoolcoc/rocket-slog-fairing","archived":false,"fork":false,"pushed_at":"2019-05-22T14:54:50.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T14:29:18.430Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/romac.png","metadata":{"files":{"readme":"README.adoc","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}},"created_at":"2019-05-22T14:43:30.000Z","updated_at":"2022-04-08T10:27:05.000Z","dependencies_parsed_at":"2023-02-22T07:30:34.448Z","dependency_job_id":null,"html_url":"https://github.com/romac/rocket-slog-fairing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/romac/rocket-slog-fairing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romac%2Frocket-slog-fairing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romac%2Frocket-slog-fairing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romac%2Frocket-slog-fairing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romac%2Frocket-slog-fairing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/romac","download_url":"https://codeload.github.com/romac/rocket-slog-fairing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romac%2Frocket-slog-fairing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34927675,"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-06-29T02:00:05.398Z","response_time":58,"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-11-06T02:05:36.128Z","updated_at":"2026-06-29T12:31:37.731Z","avatar_url":"https://github.com/romac.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Integrate a slog Logger with your Rocket.rs application\n\nhttp://pwoolcoc.gitlab.io/rocket-slog-fairing/rocket_slog/index.html[Documentation (master)]\n\nThis is a fairing that you can attach to your rocket.rs application to enable use of a slog `Logger` in your\nhandlers\n\n== Installation (for rocket v0.3)\n\nIn your `Cargo.toml`, put the following in the `[dependencies]` section:\n\n----\nrocket-slog = \"0.3\"\n----\n\nFor pre-2018-edition crates, put the following in your crate root:\n\n----\nextern crate rocket_slog;\n----\n\n== Installation (for rocket 0.4)\n\nIn your `Cargo.toml`, put the following in the `[dependencies]` section:\n\n----\nrocket-slog = \"0.4.0-rc.2\"\n----\n\nFor pre-2018-edition crates, put the following in your crate root:\n\n----\nextern crate rocket_slog;\n----\n\n== Example (for rocket 0.3)\n\nHere is an example application that uses the rocket-slog fairing. Note that you should probably disable the builtin\nrocket logger unless you want the output from both logging systems.\n\n----\n#![feature(plugin)]\n#![plugin(rocket_codegen)]\n\nextern crate rocket;\nextern crate rocket_slog;\n#[macro_use(debug)] extern crate slog;\nextern crate sloggers;\n\nuse std::error::Error;\nuse rocket::{Config};\nuse rocket_slog::{SyncLogger, SlogFairing};\nuse sloggers::{\n    Build,\n    terminal::{\n        TerminalLoggerBuilder,\n        Destination,\n    },\n    types::Severity,\n};\n\n#[get(\"/\")]\nfn index(logger: SyncLogger) -\u003e \u0026'static str {\n    debug!(logger.get(), \"THIS IS A CUSTOM MESSAGE\");\n    \"hello, world\"\n}\n\nfn main() -\u003e Result\u003c(), Box\u003cError\u003e\u003e {\n    let mut builder = TerminalLoggerBuilder::new();\n    builder.level(Severity::Debug);\n    builder.destination(Destination::Stderr);\n    let logger = builder.build()?;\n\n    let fairing = SlogFairing::new(logger);\n\n    let config = Config::development().unwrap();\n    rocket::custom(config, false) // disables logging\n        .attach(fairing)\n        .mount(\"/\", routes![index])\n        .launch();\n    Ok(())\n}\n----\n\n== Example (for rocket 0.4)\n\n----\n#![feature(proc_macro_hygiene, decl_macro)]\n\n#[macro_use] extern crate rocket;\n#[macro_use(debug)] extern crate slog;\nextern crate rocket_slog;\nextern crate sloggers;\n\nuse std::error::Error;\nuse rocket::config::{Config, Environment, LoggingLevel};\nuse rocket_slog::{SlogFairing, SyncLogger};\nuse sloggers::{\n    Build,\n    terminal::{\n        TerminalLoggerBuilder,\n        Destination,\n    },\n    types::Severity,\n};\n\n#[get(\"/\")]\nfn index(log: SyncLogger) -\u003e \u0026'static str {\n    debug!(log, \"some log message\");\n    \"Hello world\"\n}\n\nfn main() -\u003e Result\u003c(), Box\u003cError\u003e\u003e {\n    let mut builder = TerminalLoggerBuilder::new();\n    builder.level(Severity::Debug);\n    builder.destination(Destination::Stderr);\n    let logger = builder.build()?;\n    let fairing = SlogFairing::new(logger);\n    let config = Config::build(Environment::Development)\n            .log_level(LoggingLevel::Off) // disables logging\n            .finalize()\n            .unwrap();\n    rocket::custom(config)\n        .mount(\"/\", routes![index])\n        .attach(fairing)\n        .launch();\n    Ok(())\n}\n----\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromac%2Frocket-slog-fairing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromac%2Frocket-slog-fairing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromac%2Frocket-slog-fairing/lists"}