@@ -91,7 +91,7 @@ func (s *stdoutLogger) writeMessage(fnType logFunctionType, message string) {
9191
9292 fnInformation .stream .Write ([]byte (message ))
9393
94- if s .loadingText != nil {
94+ if s .loadingText != nil && fnType != fatalFn {
9595 s .loadingText .Start ()
9696 }
9797 }
@@ -244,7 +244,19 @@ func (s *stdoutLogger) Fatal(args ...interface{}) {
244244 s .logMutex .Lock ()
245245 defer s .logMutex .Unlock ()
246246
247- s .writeMessage (fatalFn , fmt .Sprintln (args ... ))
247+ if s .loadingText != nil {
248+ s .loadingText .Stop ()
249+ s .loadingText = nil
250+ }
251+
252+ fnInformation := fnTypeInformationMap [fatalFn ]
253+
254+ ct .Foreground (fnInformation .color , false )
255+ fnInformation .stream .Write ([]byte (fnInformation .tag ))
256+
257+ ct .ResetColor ()
258+ fnInformation .stream .Write ([]byte (fmt .Sprintln (args ... )))
259+
248260 s .writeMessageToFileLogger (fatalFn , args ... )
249261
250262 if s .fileLogger == nil {
@@ -256,7 +268,18 @@ func (s *stdoutLogger) Fatalf(format string, args ...interface{}) {
256268 s .logMutex .Lock ()
257269 defer s .logMutex .Unlock ()
258270
259- s .writeMessage (fatalFn , fmt .Sprintf (format , args ... )+ "\n " )
271+ if s .loadingText != nil {
272+ s .loadingText .Stop ()
273+ s .loadingText = nil
274+ }
275+
276+ fnInformation := fnTypeInformationMap [fatalFn ]
277+
278+ ct .Foreground (fnInformation .color , false )
279+ fnInformation .stream .Write ([]byte (fnInformation .tag ))
280+
281+ ct .ResetColor ()
282+ fnInformation .stream .Write ([]byte (fmt .Sprintf (format , args ... )))
260283 s .writeMessageToFileLoggerf (fatalFn , format , args ... )
261284
262285 if s .fileLogger == nil {
@@ -268,6 +291,11 @@ func (s *stdoutLogger) Panic(args ...interface{}) {
268291 s .logMutex .Lock ()
269292 defer s .logMutex .Unlock ()
270293
294+ if s .loadingText != nil {
295+ s .loadingText .Stop ()
296+ s .loadingText = nil
297+ }
298+
271299 s .writeMessage (panicFn , fmt .Sprintln (args ... ))
272300 s .writeMessageToFileLogger (panicFn , args ... )
273301
0 commit comments