Skip to content

Commit 8719b40

Browse files
author
ffranr
authored
Merge pull request #1269 from lightninglabs/improve-logging
Improve logging
2 parents 0f68226 + ee22f42 commit 8719b40

File tree

5 files changed

+28
-7
lines changed

5 files changed

+28
-7
lines changed

fn/option.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
package fn
22

3-
// Option[A] represents a value which may or may not be there. This is very
3+
import "fmt"
4+
5+
// Option represents a value which may or may not be there. This is very
46
// often preferable to nil-able pointers.
57
type Option[A any] struct {
68
isSome bool
79
some A
810
}
911

12+
// String returns a string representation of the Option.
13+
func (o Option[A]) String() string {
14+
if o.isSome {
15+
return fmt.Sprintf("Some(%v)", o.some)
16+
}
17+
18+
return "None"
19+
}
20+
1021
// Some trivially injects a value into an optional context.
1122
//
1223
// Some : A -> Option[A].

rfq/negotiator.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ func (n *Negotiator) queryBidFromPriceOracle(assetSpecifier asset.Specifier,
119119
ctx, cancel := n.WithCtxQuitNoTimeout()
120120
defer cancel()
121121

122+
log.Debugf("Querying price oracle for bid price (asset_specifier=%s, "+
123+
"asset_max_amt=%s, payment_max_amt=%s, asset_rate_hint=%s)",
124+
assetSpecifier.String(), assetMaxAmt.String(),
125+
paymentMaxAmt.String(), assetRateHint.String())
126+
122127
oracleResponse, err := n.cfg.PriceOracle.QueryBidPrice(
123128
ctx, assetSpecifier, assetMaxAmt, paymentMaxAmt, assetRateHint,
124129
)
@@ -240,6 +245,11 @@ func (n *Negotiator) queryAskFromPriceOracle(assetSpecifier asset.Specifier,
240245
ctx, cancel := n.WithCtxQuitNoTimeout()
241246
defer cancel()
242247

248+
log.Debugf("Querying price oracle for ask price (asset_specifier=%s, "+
249+
"asset_max_amt=%s, payment_max_amt=%s, asset_rate_hint=%s)",
250+
assetSpecifier.String(), assetMaxAmt.String(),
251+
paymentMaxAmt.String(), assetRateHint.String())
252+
243253
oracleResponse, err := n.cfg.PriceOracle.QueryAskPrice(
244254
ctx, assetSpecifier, assetMaxAmt, paymentMaxAmt,
245255
assetRateHint,
@@ -439,7 +449,7 @@ func (n *Negotiator) HandleIncomingSellRequest(
439449
sendOutgoingMsg(msg)
440450

441451
// Add an error to the error channel and return.
442-
err = fmt.Errorf("failed to query ask price from "+
452+
err = fmt.Errorf("failed to query bid price from "+
443453
"oracle: %w", err)
444454
n.cfg.ErrChan <- err
445455
return

server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -997,8 +997,8 @@ func (s *Server) ChannelFinalized(pid funding.PendingChanID) error {
997997
func (s *Server) ShouldHandleTraffic(cid lnwire.ShortChannelID,
998998
fundingBlob lfn.Option[tlv.Blob]) (bool, error) {
999999

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

10031003
if err := s.waitForReady(); err != nil {
10041004
return false, err

tapchannel/aux_funding_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,8 +2218,8 @@ func (f *FundingController) CanHandle(msg msgmux.PeerMsg) bool {
22182218
return true
22192219
}
22202220

2221-
log.Debugf("Failed to handle: %T", msg.Message)
2222-
2221+
log.Tracef("FundingController encountered an unsupported message "+
2222+
"type: %T", msg.Message)
22232223
return false
22242224
}
22252225

universe/auto_syncer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func (f *FederationEnvoy) Stop() error {
199199
func (f *FederationEnvoy) syncServerState(ctx context.Context,
200200
addr ServerAddr, syncConfigs SyncConfigs) error {
201201

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

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

0 commit comments

Comments
 (0)