mirror of
https://github.com/minio/minio.git
synced 2025-11-29 05:19:03 -05:00
logger: Disassociate shared log config between console, file and syslog (#3333)
logurs is not helping us to set different log formats (json/text) to different loggers. Now, we create different logurs instances and call them in errorIf and fatalIf
This commit is contained in:
committed by
Harshavardhana
parent
01ae5bb39c
commit
22c98d3fa2
@@ -39,8 +39,12 @@ func TestCallerLocation(t *testing.T) {
|
||||
func TestLogger(t *testing.T) {
|
||||
var buffer bytes.Buffer
|
||||
var fields logrus.Fields
|
||||
log.Out = &buffer
|
||||
log.Formatter = new(logrus.JSONFormatter)
|
||||
testLog := logrus.New()
|
||||
testLog.Out = &buffer
|
||||
testLog.Formatter = new(logrus.JSONFormatter)
|
||||
log.mu.Lock()
|
||||
log.loggers = append(log.loggers, testLog)
|
||||
log.mu.Unlock()
|
||||
|
||||
errorIf(errors.New("Fake error"), "Failed with error.")
|
||||
err := json.Unmarshal(buffer.Bytes(), &fields)
|
||||
|
||||
Reference in New Issue
Block a user