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

lightningnetwork / lnd / 12231215572

09 Dec 2024 07:52AM UTC coverage: 58.805% (+9.0%) from 49.807%
12231215572

push

github

web-flow
Merge pull request #9338 from yyforyongyu/fix-invoice-htlcs-order

lnrpc: sort `Invoice.HTLCs` based on `HtlcIndex`

3 of 3 new or added lines in 1 file covered. (100.0%)

400 existing lines in 30 files now uncovered.

133172 of 226462 relevant lines covered (58.81%)

19432.11 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 {
3✔
19
        return &ShutdownLogger{
3✔
20
                Logger:   logger,
3✔
21
                shutdown: shutdown,
3✔
22
        }
3✔
23
}
3✔
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