[READ-ONLY] Mirror of https://github.com/FoxxMD/docker-proxy-filter. Filter the contents of Docker API responses
docker docker-socket-proxy filter
0

Configure Feed

Select the types of activity you want to include in your feed.

use envlogger

FoxxMD (Oct 7, 2025, 7:33 PM UTC) 678ce3cb cdffb5ce

+25 -14
+16
Cargo.lock
··· 299 299 "serde_json", 300 300 "slog", 301 301 "slog-async", 302 + "slog-envlogger", 302 303 "slog-scope", 303 304 "slog-stdlog", 304 305 "slog-term", ··· 1705 1706 "slog", 1706 1707 "take_mut", 1707 1708 "thread_local", 1709 + ] 1710 + 1711 + [[package]] 1712 + name = "slog-envlogger" 1713 + version = "2.2.0" 1714 + source = "registry+https://github.com/rust-lang/crates.io-index" 1715 + checksum = "906a1a0bc43fed692df4b82a5e2fbfc3733db8dad8bb514ab27a4f23ad04f5c0" 1716 + dependencies = [ 1717 + "log", 1718 + "regex", 1719 + "slog", 1720 + "slog-async", 1721 + "slog-scope", 1722 + "slog-stdlog", 1723 + "slog-term", 1708 1724 ] 1709 1725 1710 1726 [[package]]
+1
Cargo.toml
··· 15 15 serde_json = "1.0.145" 16 16 slog = "2.8.0" 17 17 slog-async = "2.8.0" 18 + slog-envlogger = "2.2.0" 18 19 slog-scope = "4.4.0" 19 20 slog-stdlog = "4.1.1" 20 21 slog-term = "2.9.2"
+8 -14
src/main.rs
··· 7 7 #[macro_use] 8 8 extern crate log; 9 9 10 + use slog_envlogger; 11 + 10 12 use futures_util::TryStreamExt; 11 13 use ::http::StatusCode; 12 - use ntex::{http::{self, HttpMessage}, web::{self, HttpResponse, Responder}}; 14 + use ntex::{http::{self, HttpMessage}, web::{self}}; 13 15 use std::sync::{Arc, Mutex}; 14 16 15 - use slog::{Drain, Logger}; 17 + use slog::{Drain}; 16 18 use dotenv::dotenv; 17 19 use std::env; 18 20 use std::collections::HashMap; ··· 83 85 client: web::types::State<http::Client>, 84 86 forward_url: web::types::State<url::Url>, 85 87 container_name: web::types::State<String>, 86 - //log: web::types::State<Logger>, 87 88 scrub_env: web::types::State<bool>, 88 89 data: web::types::State<AppStateWithContainerMap> 89 90 ) -> Result<web::HttpResponse, web::Error> { ··· 199 200 // match_container_get(&haystack).is_some() 200 201 // } 201 202 202 - fn is_container_json(haystack: &str) -> bool { 203 - match match_container_get(&haystack) { 204 - Some(m) => m.resource == "json", 205 - None => false 206 - } 207 - } 208 - 209 - 210 203 fn is_container_named(container: &ContainerSummary, container_name: &String) -> bool { 211 204 return Option::is_some(&container.names.clone().unwrap().iter().find(|&y| { 212 205 return y.contains(container_name); ··· 243 236 244 237 #[ntex::main] 245 238 async fn main() -> std::io::Result<()> { 239 + dotenv().ok(); 240 + 246 241 let decorator = slog_term::TermDecorator::new().build(); 247 242 let drain = slog_term::FullFormat::new(decorator).build().fuse(); 248 243 let drain = slog_async::Async::new(drain).build().fuse(); 249 - let logger = slog::Logger::root(drain, o!()); 244 + let envlogger = slog_envlogger::new(drain); 245 + let logger = slog::Logger::root(envlogger, o!()); 250 246 251 247 let _guard = slog_scope::set_global_logger(logger); 252 248 slog_scope::scope(&slog_scope::logger().new(o!("scope" => "1")), || ()); 253 249 let _log_guard = slog_stdlog::init().unwrap(); 254 - 255 - dotenv().ok(); 256 250 257 251 258 252 let proxy_url_env = env::var("PROXY_URL");