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

lightningnetwork / lnd / 11333802987

14 Oct 2024 07:26PM UTC coverage: 57.859% (-0.9%) from 58.779%
11333802987

Pull #9148

github

ProofOfKeags
lnwire: remove kickoff feerate from propose/commit
Pull Request #9148: DynComms [2/n]: lnwire: add authenticated wire messages for Dyn*

351 of 627 new or added lines in 12 files covered. (55.98%)

19006 existing lines in 242 files now uncovered.

99279 of 171588 relevant lines covered (57.86%)

36687.28 hits per line

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

72.22
/build/prefix_log.go
1
package build
2

3
import "github.com/btcsuite/btclog"
4

5
// PrefixLog is a pass-through logger that adds a prefix to every logged line.
6
type PrefixLog struct {
7
        log    btclog.Logger
8
        prefix string
9
}
10

11
// NewPrefixLog instantiates a new prefixed logger.
12
func NewPrefixLog(prefix string, log btclog.Logger) *PrefixLog {
1,140✔
13
        return &PrefixLog{
1,140✔
14
                prefix: prefix,
1,140✔
15
                log:    log,
1,140✔
16
        }
1,140✔
17
}
1,140✔
18

19
// addFormatPrefix prepends the prefix to a format string.
20
func (p *PrefixLog) addFormatPrefix(s string) string {
64,030✔
21
        return p.prefix + " " + s
64,030✔
22
}
64,030✔
23

24
// addArgsPrefix prepends the prefix to a list of arguments.
25
func (p *PrefixLog) addArgsPrefix(args []interface{}) []interface{} {
11,805✔
26
        return append([]interface{}{p.prefix}, args...)
11,805✔
27
}
11,805✔
28

29
// Tracef formats message according to format specifier and writes to to log
30
// with LevelTrace.
31
func (p *PrefixLog) Tracef(format string, params ...interface{}) {
47,748✔
32
        p.log.Tracef(p.addFormatPrefix(format), params...)
47,748✔
33
}
47,748✔
34

35
// Debugf formats message according to format specifier and writes to log with
36
// LevelDebug.
37
func (p *PrefixLog) Debugf(format string, params ...interface{}) {
11,631✔
38
        p.log.Debugf(p.addFormatPrefix(format), params...)
11,631✔
39
}
11,631✔
40

41
// Infof formats message according to format specifier and writes to log with
42
// LevelInfo.
43
func (p *PrefixLog) Infof(format string, params ...interface{}) {
2,913✔
44
        p.log.Infof(p.addFormatPrefix(format), params...)
2,913✔
45
}
2,913✔
46

47
// Warnf formats message according to format specifier and writes to to log with
48
// LevelWarn.
49
func (p *PrefixLog) Warnf(format string, params ...interface{}) {
865✔
50
        p.log.Warnf(p.addFormatPrefix(format), params...)
865✔
51
}
865✔
52

53
// Errorf formats message according to format specifier and writes to to log
54
// with LevelError.
55
func (p *PrefixLog) Errorf(format string, params ...interface{}) {
873✔
56
        p.log.Errorf(p.addFormatPrefix(format), params...)
873✔
57
}
873✔
58

59
// Criticalf formats message according to format specifier and writes to log
60
// with LevelCritical.
61
func (p *PrefixLog) Criticalf(format string, params ...interface{}) {
×
62
        p.log.Criticalf(p.addFormatPrefix(format), params...)
×
63
}
×
64

65
// Trace formats message using the default formats for its operands and writes
66
// to log with LevelTrace.
67
func (p *PrefixLog) Trace(v ...interface{}) {
11,198✔
68
        p.log.Trace(p.addArgsPrefix(v)...)
11,198✔
69
}
11,198✔
70

71
// Debug formats message using the default formats for its operands and writes
72
// to log with LevelDebug.
73
func (p *PrefixLog) Debug(v ...interface{}) {
2✔
74
        p.log.Debug(p.addArgsPrefix(v)...)
2✔
75
}
2✔
76

77
// Info formats message using the default formats for its operands and writes to
78
// log with LevelInfo.
79
func (p *PrefixLog) Info(v ...interface{}) {
588✔
80
        p.log.Info(p.addArgsPrefix(v)...)
588✔
81
}
588✔
82

83
// Warn formats message using the default formats for its operands and writes to
84
// log with LevelWarn.
85
func (p *PrefixLog) Warn(v ...interface{}) {
17✔
86
        p.log.Warn(p.addArgsPrefix(v)...)
17✔
87
}
17✔
88

89
// Error formats message using the default formats for its operands and writes
90
// to log with LevelError.
UNCOV
91
func (p *PrefixLog) Error(v ...interface{}) {
×
UNCOV
92
        p.log.Error(p.addArgsPrefix(v)...)
×
UNCOV
93
}
×
94

95
// Critical formats message using the default formats for its operands and
96
// writes to log with LevelCritical.
97
func (p *PrefixLog) Critical(v ...interface{}) {
×
98
        p.log.Critical(p.addArgsPrefix(v)...)
×
99
}
×
100

101
// Level returns the current logging level.
102
func (p *PrefixLog) Level() btclog.Level {
×
103
        return p.log.Level()
×
104
}
×
105

106
// SetLevel changes the logging level to the passed level.
107
func (p *PrefixLog) SetLevel(level btclog.Level) {
×
108
        p.log.SetLevel(level)
×
109
}
×
110

111
// Assert that PrefixLog fulfills the btclog.Logger interface.
112
var _ btclog.Logger = &PrefixLog{}
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