mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
fix: console logger regression with dynamic logger webhook registration (#14346)
fixes a regression from #14289
This commit is contained in:
parent
1dbb3f6f43
commit
65b1a4282e
@ -129,7 +129,7 @@ func (sys *HTTPConsoleLoggerSys) Endpoint() string {
|
||||
|
||||
// String - stringer function for interface compatibility
|
||||
func (sys *HTTPConsoleLoggerSys) String() string {
|
||||
return "console+http"
|
||||
return logger.ConsoleLoggerTgt
|
||||
}
|
||||
|
||||
// Content returns the console stdout log
|
||||
|
@ -29,6 +29,9 @@ import (
|
||||
c "github.com/minio/pkg/console"
|
||||
)
|
||||
|
||||
// ConsoleLoggerTgt is a stringified value to represent console logging
|
||||
const ConsoleLoggerTgt = "console+http"
|
||||
|
||||
// Logger interface describes the methods that need to be implemented to satisfy the interface requirements.
|
||||
type Logger interface {
|
||||
json(msg string, args ...interface{})
|
||||
|
@ -139,6 +139,14 @@ func UpdateTargets(cfg Config) error {
|
||||
}
|
||||
|
||||
swapMu.Lock()
|
||||
for _, tgt := range targets {
|
||||
// Preserve console target when dynamically updating
|
||||
// other HTTP targets, console target is always present.
|
||||
if tgt.String() == ConsoleLoggerTgt {
|
||||
updated = append(updated, tgt)
|
||||
break
|
||||
}
|
||||
}
|
||||
atomic.StoreInt32(&nTargets, int32(len(updated)))
|
||||
cancelAllTargets() // cancel running targets
|
||||
targets = updated
|
||||
|
Loading…
Reference in New Issue
Block a user