Skip to content

Commit

Permalink
Remove print statements and use slog instead
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksej-paschenko committed Apr 17, 2024
1 parent ec02c1b commit fe7c852
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions liteclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"encoding/binary"
"fmt"
"log/slog"

Check failure on line 8 in liteclient/client.go

View workflow job for this annotation

GitHub Actions / unit-tests

package log/slog is not in GOROOT (/opt/hostedtoolcache/go/1.19.13/x64/src/log/slog)
"math/rand"
"sync"
"time"
Expand Down Expand Up @@ -144,12 +145,11 @@ func decodeLength(b []byte) (int, []byte, error) {
func (c *Client) reader() {
for p := range c.connection.Responses() {
if p.MagicType() != magicADNLAnswer {
fmt.Println("unknown type", p.MagicType()) //todo: remove
continue
}
err := c.processQueryAnswer(p)
if err != nil {
fmt.Println(err) //todo: switch to debug logger
slog.Info("liteclient.reader() error", "err", err)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions liteclient/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package liteclient
import (
"context"
"encoding/binary"
"fmt"
"log/slog"
mrand "math/rand"
"sync"
"time"
Expand Down Expand Up @@ -159,7 +159,7 @@ func (c *Connection) ping() {
c.registerPing(binary.LittleEndian.Uint64(ping[4:]))
err = c.Send(p)
if err != nil && IsNotConnectedYet(err) {
fmt.Printf("%s ping error: %v\n", c.host, err)
slog.Info("ping error", "host", c.host, "error", err)
continue
}
}
Expand Down

0 comments on commit fe7c852

Please sign in to comment.