mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
re-use StorageAPI while loading drive formats (#19770)
Bonus: safe settings for deployment ID to avoid races
This commit is contained in:
@@ -69,13 +69,16 @@ func Fatal(err error, msg string, data ...interface{}) {
|
||||
}
|
||||
|
||||
func fatal(err error, msg string, data ...interface{}) {
|
||||
var errMsg string
|
||||
if msg != "" {
|
||||
errMsg = errorFmtFunc(fmt.Sprintf(msg, data...), err, jsonFlag)
|
||||
if msg == "" {
|
||||
if len(data) > 0 {
|
||||
msg = fmt.Sprint(data...)
|
||||
} else {
|
||||
msg = "a fatal error"
|
||||
}
|
||||
} else {
|
||||
errMsg = err.Error()
|
||||
msg = fmt.Sprintf(msg, data...)
|
||||
}
|
||||
consoleLog(fatalMessage, errMsg)
|
||||
consoleLog(fatalMessage, errorFmtFunc(msg, err, jsonFlag))
|
||||
}
|
||||
|
||||
var fatalMessage fatalMsg
|
||||
@@ -183,13 +186,14 @@ func (i infoMsg) quiet(msg string, args ...interface{}) {
|
||||
func (i infoMsg) pretty(msg string, args ...interface{}) {
|
||||
if msg == "" {
|
||||
fmt.Fprintln(Output, args...)
|
||||
} else {
|
||||
fmt.Fprintf(Output, msg, args...)
|
||||
}
|
||||
fmt.Fprintf(Output, msg, args...)
|
||||
}
|
||||
|
||||
type errorMsg struct{}
|
||||
|
||||
var errorm errorMsg
|
||||
var errorMessage errorMsg
|
||||
|
||||
func (i errorMsg) json(msg string, args ...interface{}) {
|
||||
var message string
|
||||
@@ -217,8 +221,9 @@ func (i errorMsg) quiet(msg string, args ...interface{}) {
|
||||
func (i errorMsg) pretty(msg string, args ...interface{}) {
|
||||
if msg == "" {
|
||||
fmt.Fprintln(Output, args...)
|
||||
} else {
|
||||
fmt.Fprintf(Output, msg, args...)
|
||||
}
|
||||
fmt.Fprintf(Output, msg, args...)
|
||||
}
|
||||
|
||||
// Error :
|
||||
@@ -226,7 +231,7 @@ func Error(msg string, data ...interface{}) {
|
||||
if DisableErrorLog {
|
||||
return
|
||||
}
|
||||
consoleLog(errorm, msg, data...)
|
||||
consoleLog(errorMessage, msg, data...)
|
||||
}
|
||||
|
||||
// Info :
|
||||
|
||||
Reference in New Issue
Block a user