2 stable releases

1.1.0 Sep 27, 2024
1.0.0 Jan 11, 2024

#1687 in Network programming

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