• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lightningnetwork / lnd / 15574102646

11 Jun 2025 01:44AM UTC coverage: 68.554% (+9.9%) from 58.637%
15574102646

Pull #9652

github

web-flow
Merge eb863e46a into 92a5d35cf
Pull Request #9652: lnwallet/chancloser: fix flake in TestRbfCloseClosingNegotiationLocal

11 of 12 new or added lines in 1 file covered. (91.67%)

7276 existing lines in 84 files now uncovered.

134508 of 196208 relevant lines covered (68.55%)

44569.29 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.48
/lnutils/log.go
1
package lnutils
2

3
import (
4
        "log/slog"
5
        "strings"
6

7
        "github.com/btcsuite/btcd/btcec/v2"
8
        "github.com/btcsuite/btclog/v2"
9
        "github.com/davecgh/go-spew/spew"
10
)
11

12
// LogClosure is used to provide a closure over expensive logging operations so
13
// don't have to be performed when the logging level doesn't warrant it.
14
type LogClosure func() string
15

16
// String invokes the underlying function and returns the result.
17
func (c LogClosure) String() string {
14✔
18
        return c()
14✔
19
}
14✔
20

21
// NewLogClosure returns a new closure over a function that returns a string
22
// which itself provides a Stringer interface so that it can be used with the
23
// logging system.
24
func NewLogClosure(c func() string) LogClosure {
5,916✔
25
        return LogClosure(c)
5,916✔
26
}
5,916✔
27

28
// SpewLogClosure takes an interface and returns the string of it created from
29
// `spew.Sdump` in a LogClosure.
30
func SpewLogClosure(a any) LogClosure {
18,150✔
31
        return func() string {
18,164✔
32
                return spew.Sdump(a)
14✔
33
        }
14✔
34
}
35

36
// NewSeparatorClosure returns a new closure that logs a separator line.
37
func NewSeparatorClosure() LogClosure {
8✔
38
        return func() string {
14✔
39
                return strings.Repeat("=", 80)
6✔
40
        }
6✔
41
}
42

43
// LogPubKey returns a slog attribute for logging a public key in hex format.
44
func LogPubKey(key string, pubKey *btcec.PublicKey) slog.Attr {
60✔
45
        // Handle nil pubkey gracefully, although callers should ideally prevent
60✔
46
        // this.
60✔
47
        if pubKey == nil {
60✔
UNCOV
48
                return btclog.Fmt(key, "<nil>")
×
UNCOV
49
        }
×
50

51
        return btclog.Hex6(key, pubKey.SerializeCompressed())
60✔
52
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc