mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-08 14:57:38 +02:00
build: add CriticalS to ShutdownLogger
Ensure that the ShutdownLogger correctly calls shutdown for the new CriticalS method added to the btclog.Logger.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/btcsuite/btclog/v2"
|
||||
)
|
||||
|
||||
@@ -41,3 +43,16 @@ func (s *ShutdownLogger) Critical(v ...interface{}) {
|
||||
s.Logger.Info("Sending request for shutdown")
|
||||
s.shutdown()
|
||||
}
|
||||
|
||||
// CriticalS writes a structured log with the given message and key-value pair
|
||||
// attributes with LevelCritical to the log. It will then call the shutdown
|
||||
// logger's shutdown function to prompt safe shutdown.
|
||||
//
|
||||
// Note: it is part of the btclog.Logger interface.
|
||||
func (s *ShutdownLogger) CriticalS(ctx context.Context, msg string, err error,
|
||||
attr ...interface{}) {
|
||||
|
||||
s.Logger.CriticalS(ctx, msg, err, attr...)
|
||||
s.Logger.Info("Sending request for shutdown")
|
||||
s.shutdown()
|
||||
}
|
||||
|
Reference in New Issue
Block a user