mirror of https://github.com/jetkvm/kvm.git
chore: log msg data only when debug or trace mode
This commit is contained in:
parent
a4f0c0d298
commit
94a388336e
|
@ -158,7 +158,11 @@ func newSession(config SessionConfig) (*Session, error) {
|
||||||
case "hidrpc":
|
case "hidrpc":
|
||||||
session.HidChannel = d
|
session.HidChannel = d
|
||||||
d.OnMessage(func(msg webrtc.DataChannelMessage) {
|
d.OnMessage(func(msg webrtc.DataChannelMessage) {
|
||||||
l := scopedLogger.With().Str("data", string(msg.Data)).Int("length", len(msg.Data)).Logger()
|
l := scopedLogger.With().Int("length", len(msg.Data)).Logger()
|
||||||
|
// only log data if the log level is debug or lower
|
||||||
|
if scopedLogger.GetLevel() > zerolog.DebugLevel {
|
||||||
|
l = l.With().Str("data", string(msg.Data)).Logger()
|
||||||
|
}
|
||||||
|
|
||||||
if msg.IsString {
|
if msg.IsString {
|
||||||
l.Warn().Msg("received string data in HID RPC message handler")
|
l.Warn().Msg("received string data in HID RPC message handler")
|
||||||
|
|
Loading…
Reference in New Issue