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

lightningnetwork / lnd / 11170835610

03 Oct 2024 10:41PM UTC coverage: 49.188% (-9.6%) from 58.738%
11170835610

push

github

web-flow
Merge pull request #9154 from ziggie1984/master

multi: bump btcd version.

3 of 6 new or added lines in 6 files covered. (50.0%)

26110 existing lines in 428 files now uncovered.

97359 of 197934 relevant lines covered (49.19%)

1.04 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 {
2✔
13
        return &PrefixLog{
2✔
14
                prefix: prefix,
2✔
15
                log:    log,
2✔
16
        }
2✔
17
}
2✔
18

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

24
// addArgsPrefix prepends the prefix to a list of arguments.
25
func (p *PrefixLog) addArgsPrefix(args []interface{}) []interface{} {
2✔
26
        return append([]interface{}{p.prefix}, args...)
2✔
27
}
2✔
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{}) {
2✔
32
        p.log.Tracef(p.addFormatPrefix(format), params...)
2✔
33
}
2✔
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{}) {
2✔
38
        p.log.Debugf(p.addFormatPrefix(format), params...)
2✔
39
}
2✔
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✔
44
        p.log.Infof(p.addFormatPrefix(format), params...)
2✔
45
}
2✔
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{}) {
2✔
50
        p.log.Warnf(p.addFormatPrefix(format), params...)
2✔
51
}
2✔
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{}) {
2✔
56
        p.log.Errorf(p.addFormatPrefix(format), params...)
2✔
57
}
2✔
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{}) {
2✔
68
        p.log.Trace(p.addArgsPrefix(v)...)
2✔
69
}
2✔
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{}) {
2✔
80
        p.log.Info(p.addArgsPrefix(v)...)
2✔
81
}
2✔
82

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

89
// Error formats message using the default formats for its operands and writes
90
// to log with LevelError.
91
func (p *PrefixLog) Error(v ...interface{}) {
2✔
92
        p.log.Error(p.addArgsPrefix(v)...)
2✔
93
}
2✔
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