Skip to content

Commit

Permalink
fix: fix standard log module output bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sam80180 committed Jan 13, 2024
1 parent d2c1795 commit 45aa1dc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/util/log.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package util

import (
"fmt"
stdlog "log"
"os"
"regexp"
Expand Down Expand Up @@ -55,6 +56,10 @@ func (LogrusWriter) Write(data []byte) (int, error) {
if strings.HasSuffix(logmessage, "\n") {
logmessage = logmessage[:len(logmessage)-1]
}
logrus.Infof("[gousb] %s", logmessage)
if logmessage == "handle_events: error: libusb: interrupted [code -10]" { // this annoying message
logrus.Debugf("[gousb] %s", logmessage)
} else { // other standard log module output
fmt.Print(string(data))
}
return len(logmessage), nil
}

0 comments on commit 45aa1dc

Please sign in to comment.