How to configure log level in golang? #5424
-
|
I am using valkey GLIDE go in my project. I wanted to turn off the logger and use my own |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi @YimingIsCOLD, If i am understanding correctly, It seems like there are 2 asks.
The Go client doesn't currently expose a logger configuration API like Python (Logger.set_logger_config(LogLevel.OFF)) or Node.js (Logger.setLoggerConfig("off")). This is a known gap — we have the FFI init function in the Rust layer that supports setting the level to OFF, but the Go binding doesn't wrap it yet. We'd welcome a contribution to add a Go-level Logger API. The implementation would follow the same pattern as the other bindings — call the FFI init(level, file_name) function exposed by
None of the GLIDE language bindings (Go, Python, Node.js, Java) support plugging in a custom logger. The internal logging is handled entirely by Rust's tracing crate, and there's no callback or adapter mechanism to forward those logs into a user-provided logger. The recommended approach is:
As a workaround until the Go logger API is added, the WARN output goes to stderr, so redirecting stderr before client creation can suppress it. If this is something you’d like us to consider, please go ahead and create a new Feature request under the Issues tab with the appropriate details. From there, we’ll be happy to continue the discussion and assist you further. |
Beta Was this translation helpful? Give feedback.
Hi @YimingIsCOLD,
If i am understanding correctly, It seems like there are 2 asks.
The Go client doesn't currently expose a logger configuration API like Python (Logger.set_logger_config(LogLevel.OFF)) or Node.js (Logger.setLoggerConfig("off")). This is a known gap — we have the FFI init function in the Rust layer that supports setting the level to OFF, but the Go binding doesn't wrap it yet.
We'd welcome a contribution to add a Go-level Logger API. The implementation would follow the same pattern as the other bindings — call the FFI init(level, file_name) function exposed by
/valkey-glide/ffi/src/lib.rs. See/valkey-glide/python/glide-async/python/glide/log…