mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 13:55:17 +00:00
fix: "Lazy" Stringers to defer Sprintf and Hash until logs print (#8845)
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
)
|
||||
|
||||
type logger interface {
|
||||
@@ -21,7 +23,7 @@ func TrapSignal(logger logger, cb func()) {
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||
go func() {
|
||||
for sig := range c {
|
||||
logger.Info(fmt.Sprintf("captured %v, exiting...", sig))
|
||||
logger.Info("signal trapped", "msg", log.NewLazySprintf("captured %v, exiting...", sig))
|
||||
if cb != nil {
|
||||
cb()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user