Skip to content

Commit

Permalink
refactor: minor logging improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
devgianlu committed Sep 21, 2024
1 parent 3d54bfe commit 9e41b6c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ap/ap.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (ap *Accesspoint) init() (err error) {
cancel()
if err == nil {
// Successfully connected.
log.Infoln("connected to", addr)
log.Debugf("connected to %s", addr)
return nil
} else if attempts >= 6 {
// Only try a few times before giving up.
Expand Down Expand Up @@ -504,7 +504,7 @@ func (ap *Accesspoint) authenticate(credentials *pb.LoginCredentials) error {
}

ap.welcome = &welcome
log.Debugf("authenticated as %s", *welcome.CanonicalUsername)
log.Infof("authenticated AP as %s", *welcome.CanonicalUsername)

return nil
} else if recvPkt == PacketTypeAuthFailure {
Expand Down
5 changes: 4 additions & 1 deletion cmd/daemon/api_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/rs/cors"
"net"
"net/http"
"net/url"
"strings"
"sync"
"time"

"github.com/rs/cors"

librespot "github.com/devgianlu/go-librespot"
log "github.com/sirupsen/logrus"
"nhooyr.io/websocket"
Expand Down Expand Up @@ -262,6 +263,8 @@ func NewApiServer(address string, port int, allowOrigin string, certFile string,
return nil, fmt.Errorf("failed starting api listener: %w", err)
}

log.Infof("api server listening on %s", s.listener.Addr())

go s.serve()
return s, nil
}
Expand Down
2 changes: 1 addition & 1 deletion login5/login5.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (c *Login5) Login(credentials proto.Message) error {
if ok := resp.GetOk(); ok != nil {
c.loginOk = ok
c.loginOkExp = time.Now().Add(time.Duration(c.loginOk.AccessTokenExpiresIn) * time.Second)
log.Debugf("authenticated as %s", c.loginOk.Username)
log.Infof("authenticated Login5 as %s", c.loginOk.Username)
return nil
} else {
return fmt.Errorf("failed authenticating with login5: %v", resp.GetError())
Expand Down

0 comments on commit 9e41b6c

Please sign in to comment.