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

lightningnetwork / lnd / 12205625987

06 Dec 2024 08:23PM UTC coverage: 49.763% (-0.04%) from 49.807%
12205625987

Pull #9316

github

ziggie1984
docs: add release-notes.
Pull Request #9316: routing: fix mc blinded path behaviour.

165 of 181 new or added lines in 5 files covered. (91.16%)

238 existing lines in 28 files now uncovered.

100104 of 201163 relevant lines covered (49.76%)

2.07 hits per line

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

27.27
/build/log_shutdown.go
1
package build
2

3
import (
4
        "context"
5

6
        "github.com/btcsuite/btclog/v2"
7
)
8

9
// ShutdownLogger wraps an existing logger with a shutdown function which will
10
// be called on Critical/Criticalf to prompt shutdown.
11
type ShutdownLogger struct {
12
        btclog.Logger
13
        shutdown func()
14
}
15

16
// NewShutdownLogger creates a shutdown logger for the log provided which will
17
// use the signal package to request shutdown on critical errors.
18
func NewShutdownLogger(logger btclog.Logger, shutdown func()) *ShutdownLogger {
4✔
19
        return &ShutdownLogger{
4✔
20
                Logger:   logger,
4✔
21
                shutdown: shutdown,
4✔
22
        }
4✔
23
}
4✔
24

25
// Criticalf formats message according to format specifier and writes to
26
// log with LevelCritical. It will then call the shutdown logger's shutdown
27
// function to prompt safe shutdown.
28
//
29
// Note: it is part of the btclog.Logger interface.
30
func (s *ShutdownLogger) Criticalf(format string, params ...interface{}) {
×
31
        s.Logger.Criticalf(format, params...)
×
32
        s.Logger.Info("Sending request for shutdown")
×
33
        s.shutdown()
×
34
}
×
35

36
// Critical formats message using the default formats for its operands
37
// and writes to log with LevelCritical. It will then call the shutdown
38
// logger's shutdown function to prompt safe shutdown.
39
//
40
// Note: it is part of the btclog.Logger interface.
UNCOV
41
func (s *ShutdownLogger) Critical(v ...interface{}) {
×
UNCOV
42
        s.Logger.Critical(v)
×
UNCOV
43
        s.Logger.Info("Sending request for shutdown")
×
UNCOV
44
        s.shutdown()
×
UNCOV
45
}
×
46

47
// CriticalS writes a structured log with the given message and key-value pair
48
// attributes with LevelCritical to the log. It will then call the shutdown
49
// logger's shutdown function to prompt safe shutdown.
50
//
51
// Note: it is part of the btclog.Logger interface.
52
func (s *ShutdownLogger) CriticalS(ctx context.Context, msg string, err error,
53
        attr ...interface{}) {
×
54

×
55
        s.Logger.CriticalS(ctx, msg, err, attr...)
×
56
        s.Logger.Info("Sending request for shutdown")
×
57
        s.shutdown()
×
58
}
×
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