Merge pull request #1112 from vadmeste/fix_ls_error_with_json_enabled

Fix printing fatal message prefix when json flag is enabled
This commit is contained in:
Harshavardhana
2015-09-29 12:04:11 -07:00
+21 -27
View File
@@ -83,72 +83,66 @@ var (
return
}
// Fatal print a error message and exit
Fatal = func(data ...interface{}) {
consolePrint("Fatal", Theme["Fatal"], data...)
// fatalQuitRoutine called after fatal message printing
// by the user specific version
fatalQuitRoutine = func() {
if !IsTesting {
os.Exit(1)
}
defer func() {
IsExited = true
}()
}
// Fatal print a error message and exit
Fatal = func(data ...interface{}) {
consolePrint("Fatal", Theme["Fatal"], data...)
fatalQuitRoutine()
return
}
// Fatalf print a error message with a format specified and exit
Fatalf = func(format string, data ...interface{}) {
consolePrintf("Fatal", Theme["Fatal"], format, data...)
if !IsTesting {
os.Exit(1)
}
defer func() {
IsExited = true
}()
fatalQuitRoutine()
return
}
// Fatalln print a error message with a new line and exit
Fatalln = func(data ...interface{}) {
consolePrintln("Fatal", Theme["Fatal"], data...)
if !IsTesting {
os.Exit(1)
}
defer func() {
IsExited = true
}()
fatalQuitRoutine()
return
}
// Error prints a error message
Error = func(data ...interface{}) {
// errorQuitRoutine called after error message printing
// by the user specific version
errorQuitRoutine = func() {
if IsTesting {
defer func() {
IsError = true
}()
}
}
// Error prints a error message
Error = func(data ...interface{}) {
consolePrint("Error", Theme["Error"], data...)
errorQuitRoutine()
return
}
// Errorf print a error message with a format specified
Errorf = func(format string, data ...interface{}) {
if IsTesting {
defer func() {
IsError = true
}()
}
consolePrintf("Error", Theme["Error"], format, data...)
errorQuitRoutine()
return
}
// Errorln prints a error message with a new line
Errorln = func(data ...interface{}) {
if IsTesting {
defer func() {
IsError = true
}()
}
consolePrintln("Error", Theme["Error"], data...)
errorQuitRoutine()
return
}