You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello @0x00-ketsu! I'm here to assist you with any bugs, questions, or contributions you may have. Let me know how I can help with the issue you've raised.
The issue you're experiencing with log.FilterKey not working as expected when using log.Info but working with log.Log is likely due to how these methods handle filters differently.
In the Kratos framework, log.Info is a convenience method for logging at the INFO level, while log.Log allows you to specify the log level explicitly. The log.FilterKey function is designed to filter or mask specific keys in log entries, but its behavior might differ based on how the logging methods are implemented internally.
To address this, you can use log.Log with the INFO level explicitly, as you've done, to ensure that the FilterKey is applied correctly:
l.Log(log.LevelInfo, "password", "123456") // This will mask the password
This approach ensures that the FilterKey functionality is applied as expected. If you prefer using log.Info, you might need to check if there are any updates or patches in newer versions of Kratos that address this inconsistency.
What happened:
设置
log.FilterKey
后调用log.Info
时,log.FilterKey
无效,但是通过log.Log()
指定日志级别会生效What you expected to happen:
How to reproduce it (as minimally and precisely as possible):
kratos new helloworld
编辑
helloworld/cmd/helloworld/main.go
Anything else we need to know?:
Environment:
Kratos version (use
kratos -v
):kratos version v2.8.3
Go version (use
go version
):go version go1.24.0 darwin/arm64
OS (e.g:
cat /etc/os-release
):Darwin
Others:
The text was updated successfully, but these errors were encountered: