@@ -141,7 +141,7 @@ can be used and modified as necessary as a custom configuration.`
141141 // Stop if we are registering or unregistering against Windows SCM.
142142 stop , err := registerUnregisterService (config .Root )
143143 if err != nil {
144- logrus .Fatal (err )
144+ log . L .Fatal (err )
145145 }
146146 if stop {
147147 return nil
@@ -203,7 +203,7 @@ can be used and modified as necessary as a custom configuration.`
203203
204204 // Launch as a Windows Service if necessary
205205 if err := launchService (server , done ); err != nil {
206- logrus .Fatal (err )
206+ log . L .Fatal (err )
207207 }
208208 select {
209209 case <- ctx .Done ():
@@ -346,11 +346,7 @@ func setLogLevel(context *cli.Context, config *srvconfig.Config) error {
346346 l = config .Debug .Level
347347 }
348348 if l != "" {
349- lvl , err := logrus .ParseLevel (l )
350- if err != nil {
351- return err
352- }
353- logrus .SetLevel (lvl )
349+ return log .SetLevel (l )
354350 }
355351 return nil
356352}
@@ -361,21 +357,7 @@ func setLogFormat(config *srvconfig.Config) error {
361357 f = log .TextFormat
362358 }
363359
364- switch f {
365- case log .TextFormat :
366- logrus .SetFormatter (& logrus.TextFormatter {
367- TimestampFormat : log .RFC3339NanoFixed ,
368- FullTimestamp : true ,
369- })
370- case log .JSONFormat :
371- logrus .SetFormatter (& logrus.JSONFormatter {
372- TimestampFormat : log .RFC3339NanoFixed ,
373- })
374- default :
375- return fmt .Errorf ("unknown log format: %s" , f )
376- }
377-
378- return nil
360+ return log .SetFormat (f )
379361}
380362
381363func setLogHooks () {
@@ -394,7 +376,7 @@ func dumpStacks(writeToFile bool) {
394376 bufferLen *= 2
395377 }
396378 buf = buf [:stackSize ]
397- logrus .Infof ("=== BEGIN goroutine stack dump ===\n %s\n === END goroutine stack dump ===" , buf )
379+ log . L .Infof ("=== BEGIN goroutine stack dump ===\n %s\n === END goroutine stack dump ===" , buf )
398380
399381 if writeToFile {
400382 // Also write to file to aid gathering diagnostics
@@ -405,6 +387,6 @@ func dumpStacks(writeToFile bool) {
405387 }
406388 defer f .Close ()
407389 f .WriteString (string (buf ))
408- logrus .Infof ("goroutine stack dump written to %s" , name )
390+ log . L .Infof ("goroutine stack dump written to %s" , name )
409391 }
410392}
0 commit comments