Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve logging #1269

Merged
merged 6 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion fn/option.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
package fn

// Option[A] represents a value which may or may not be there. This is very
import "fmt"

// Option represents a value which may or may not be there. This is very
// often preferable to nil-able pointers.
type Option[A any] struct {
isSome bool
some A
}

// String returns a string representation of the Option.
func (o Option[A]) String() string {
if o.isSome {
return fmt.Sprintf("Some(%v)", o.some)
}

return "None"
ffranr marked this conversation as resolved.
Show resolved Hide resolved
}

// Some trivially injects a value into an optional context.
//
// Some : A -> Option[A].
Expand Down
12 changes: 11 additions & 1 deletion rfq/negotiator.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ func (n *Negotiator) queryBidFromPriceOracle(assetSpecifier asset.Specifier,
ctx, cancel := n.WithCtxQuitNoTimeout()
defer cancel()

log.Debugf("Querying price oracle for bid price (asset_specifier=%s, "+
"asset_max_amt=%s, payment_max_amt=%s, asset_rate_hint=%s)",
assetSpecifier.String(), assetMaxAmt.String(),
paymentMaxAmt.String(), assetRateHint.String())

oracleResponse, err := n.cfg.PriceOracle.QueryBidPrice(
ctx, assetSpecifier, assetMaxAmt, paymentMaxAmt, assetRateHint,
)
Expand Down Expand Up @@ -240,6 +245,11 @@ func (n *Negotiator) queryAskFromPriceOracle(assetSpecifier asset.Specifier,
ctx, cancel := n.WithCtxQuitNoTimeout()
defer cancel()

log.Debugf("Querying price oracle for ask price (asset_specifier=%s, "+
ffranr marked this conversation as resolved.
Show resolved Hide resolved
"asset_max_amt=%s, payment_max_amt=%s, asset_rate_hint=%s)",
assetSpecifier.String(), assetMaxAmt.String(),
paymentMaxAmt.String(), assetRateHint.String())

oracleResponse, err := n.cfg.PriceOracle.QueryAskPrice(
ctx, assetSpecifier, assetMaxAmt, paymentMaxAmt,
assetRateHint,
Expand Down Expand Up @@ -439,7 +449,7 @@ func (n *Negotiator) HandleIncomingSellRequest(
sendOutgoingMsg(msg)

// Add an error to the error channel and return.
err = fmt.Errorf("failed to query ask price from "+
err = fmt.Errorf("failed to query bid price from "+
"oracle: %w", err)
n.cfg.ErrChan <- err
return
Expand Down
4 changes: 2 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -997,8 +997,8 @@ func (s *Server) ChannelFinalized(pid funding.PendingChanID) error {
func (s *Server) ShouldHandleTraffic(cid lnwire.ShortChannelID,
fundingBlob lfn.Option[tlv.Blob]) (bool, error) {

srvrLog.Debugf("HandleTraffic called, cid=%v, fundingBlob=%v", cid,
spew.Sdump(fundingBlob))
srvrLog.Debugf("HandleTraffic called (cid=%v, fundingBlob=%x)", cid,
fundingBlob.UnwrapOr(tlv.Blob{}))

if err := s.waitForReady(); err != nil {
return false, err
Expand Down
4 changes: 2 additions & 2 deletions tapchannel/aux_funding_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2136,8 +2136,8 @@ func (f *FundingController) CanHandle(msg msgmux.PeerMsg) bool {
return true
}

log.Debugf("Failed to handle: %T", msg.Message)

log.Tracef("FundingController encountered an unsupported message "+
"type: %T", msg.Message)
return false
}

Expand Down
2 changes: 1 addition & 1 deletion universe/auto_syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (f *FederationEnvoy) Stop() error {
func (f *FederationEnvoy) syncServerState(ctx context.Context,
addr ServerAddr, syncConfigs SyncConfigs) error {

log.Infof("Syncing Universe state with server=%v", spew.Sdump(addr))
log.Infof("Syncing Universe state with server=%s", addr.HostStr())

// Attempt to sync with the remote Universe server, if this errors then
// we'll bail out early as something wrong happened.
Expand Down
Loading