Cleanup logging
Some checks failed
Run tests / test (1.25) (push) Failing after 1m42s
Run tests / test (stable) (push) Failing after 1m42s

This commit is contained in:
2026-02-23 18:26:24 +01:00
parent aabfa853ec
commit 0d159020c6
2 changed files with 10 additions and 12 deletions

View File

@@ -6,7 +6,7 @@ repos:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/golangci/golangci-lint #- repo: https://github.com/golangci/golangci-lint
rev: v2.10.1 # rev: v2.10.1
hooks: # hooks:
- id: golangci-lint # - id: golangci-lint

View File

@@ -6,7 +6,6 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"log"
"math/rand/v2" "math/rand/v2"
"slices" "slices"
"strings" "strings"
@@ -285,7 +284,7 @@ func (drv *companionDriver) Trace(path []byte) (snr []float64, err error) {
return return
} }
log.Printf("trace response:\n%s", hex.Dump(data)) Logger.Debugf("trace response:\n%s", hex.Dump(data))
return return
} }
@@ -366,8 +365,9 @@ func (drv *companionDriver) handlePushFrame(b []byte) {
case companionPushMessageWaiting: case companionPushMessageWaiting:
case companionPushLogRXData: case companionPushLogRXData:
drv.handleRXData(b[1:]) drv.handleRXData(b[1:])
case companionPushcompanionPushNewAdvert:
default: default:
log.Printf("meshcore: unhandled push %02x:\n%s", b[0], hex.Dump(b[1:])) Logger.Warnf("meshcore: unhandled push %02x:\n%s", b[0], hex.Dump(b[1:]))
} }
} }
@@ -397,7 +397,7 @@ func (drv *companionDriver) handleRXData(b []byte) {
Raw: b[2:], Raw: b[2:],
}: }:
default: default:
log.Printf("meshcore: raw packet channel full, dropping packet") Logger.Warn("meshcore: raw packet channel full, dropping packet")
} }
} }
@@ -410,7 +410,7 @@ func (drv *companionDriver) handleRXData(b []byte) {
select { select {
case drv.packets <- packet: case drv.packets <- packet:
default: default:
log.Printf("meshcore: packet channel full, dropping packet") Logger.Warn("meshcore: packet channel full, dropping packet")
} }
} }
} }
@@ -478,8 +478,6 @@ func (drv *companionDriver) sendDeviceInfo() (err error) {
drv.info.Manufacturer = decodeCString(data[19:59]) drv.info.Manufacturer = decodeCString(data[19:59])
drv.info.FirmwareVersion = decodeCString(data[59:79]) drv.info.FirmwareVersion = decodeCString(data[59:79])
log.Printf("self info: %#+v", drv.info)
return return
} }
@@ -494,7 +492,7 @@ func (drv *companionDriver) poll() {
} }
response := frame[0] response := frame[0]
Logger.Debugf("meshcore: handle %s (%02x, %d bytes)", companionResponseName(response), response, len(frame[1:])) Logger.Tracef("meshcore: handle %s (%02x, %d bytes)", companionResponseName(response), response, len(frame[1:]))
switch { switch {
case response == companionResponseError: case response == companionResponseError:
err := CompanionError{Code: frame[1]} err := CompanionError{Code: frame[1]}