MM-38712: Flush logs while exiting from store upgrade (#18438)
Our store upgrade methods used mlog.Critical and then slept for a second and triggered os.Exit. First of all, with the new mlog refactor Critical wasn't a standard log level so it was never to be logged. And secondly, this completely missed the fact that there already existed an API method Fatal which did exactly this. We mark the Critical API as deprecated, and use Fatal for all occurences. The choice should be between either to use Error or Fatal. While here, we also remove the non-standard exit codes which just confused things further while debugging. https://mattermost.atlassian.net/browse/MM-38712 ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e575315275
Коммит
688ee34054
@@ -112,6 +112,7 @@ func Error(msg string, fields ...Field) {
|
||||
}
|
||||
|
||||
// Convenience method equivalent to calling `Log` with the `Critical` level.
|
||||
// DEPRECATED: Either use Error or Fatal.
|
||||
func Critical(msg string, fields ...Field) {
|
||||
logger := getGlobalLogger()
|
||||
if logger == nil {
|
||||
@@ -120,3 +121,12 @@ func Critical(msg string, fields ...Field) {
|
||||
}
|
||||
logger.Critical(msg, fields...)
|
||||
}
|
||||
|
||||
func Fatal(msg string, fields ...Field) {
|
||||
logger := getGlobalLogger()
|
||||
if logger == nil {
|
||||
defaultLog(LvlFatal, msg, fields...)
|
||||
return
|
||||
}
|
||||
logger.Fatal(msg, fields...)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user