2 stable releases

1.1.0 Sep 27, 2024
1.0.0 Jan 11, 2024

#1768 in Network programming

Download history 2/week @ 2024-08-10 10/week @ 2024-08-17 128/week @ 2024-09-21 71/week @ 2024-09-28 3/week @ 2024-10-05 2/week @ 2024-10-12

110 downloads per month

MIT license

6KB
91 lines

tcp_env_logger

TCP logger built on top of env_logger

Example usage

Note that log_hostname can be any arbitrary value. Its purpose is to identify the server emitting the logs.

log_url is the full TCP socket connection URL.

fn setup_logger() {
    let log_hostname = std::env::var("LOG_LOCAL_HOSTNAME").expect("LOG_LOCAL_HOSTNAME not defined");
    let log_url = std::env::var("LOG_REMOTE_URL").expect("LOG_REMOTE_URL not defined");
    let env_logger = env_logger::Builder::from_default_env().build();
    EnvTcpLogger::init(log_hostname, log_url, env_logger).unwrap();
}

Dependencies

~1–1.8MB
~39K SLoC