waku-org / waku-rust-bindings

Rust wrapper over go-waku ffi
14 stars 6 forks source link

bug: gowaku.node log cannot be turned off #56

Closed hopeyen closed 1 year ago

hopeyen commented 1 year ago

We would like to reduce the amount of logs coming from the waku nodes, but the log level options aren't effective

Previous fix Discord discussion

bacv commented 1 year ago

We've previously added these test cases to verify that log level options are effective (https://github.com/waku-org/waku-rust-bindings/blob/27597d76b53cfe166285cd1c449ec4278a95a2e4/waku-bindings/tests/node.rs#L300). Could you paste the config that is not working for you?

hopeyen commented 1 year ago

Has the fix gone through a crate release yet? We are using the rust tracing crate for setting log levels, but it cannot manage log coming from gowaku node.

let filter = EnvFilter::from_default_env();
let subscriber = FmtSubscriber::builder()
    .with_env_filter(filter)
    .with_ansi(true)
    .with_target(true)
    .with_level(true)
    .with_line_number(true)
    .pretty()
    .finish();
tracing::subscriber::set_global_default(subscriber)

Also have additional handling but INFO log from gowaku still gets printed when stricter level is set

let log_level = match env::var("WAKU_LOG_LEVEL") {
        Ok(level) => match level.to_uppercase().as_str() {
            "DEBUG" => WakuLogLevel::Debug,
            "INFO" => WakuLogLevel::Info,
            "WARN" => WakuLogLevel::Warn,
            "ERROR" => WakuLogLevel::Error,
            "FATAL" => WakuLogLevel::Fatal,
            "PANIC" => WakuLogLevel::Panic,
            _ => WakuLogLevel::Warn,
        },
        Err(_) => WakuLogLevel::Error,
    };
hopeyen commented 1 year ago

fixed after the new release, thanks!!