Last active
July 30, 2019 08:12
-
-
Save meysampg/c8119606b490084b0f3162f1f66f9ee9 to your computer and use it in GitHub Desktop.
get logger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package services | |
import ( | |
"github.com/sirupsen/logrus" | |
) | |
type Logger interface { | |
// formatted methods | |
Debugf(format string, args ...interface{}) | |
Infof(format string, args ...interface{}) | |
Printf(format string, args ...interface{}) | |
Warnf(format string, args ...interface{}) | |
Errorf(format string, args ...interface{}) | |
Fatalf(format string, args ...interface{}) | |
Panicf(format string, args ...interface{}) | |
// non-formatted methods | |
Debug(args ...interface{}) | |
Info(args ...interface{}) | |
Print(args ...interface{}) | |
Warn(args ...interface{}) | |
Error(args ...interface{}) | |
Fatal(args ...interface{}) | |
Panic(args ...interface{}) | |
} | |
var logger Logger | |
func GetLogger() Logger { | |
if logger == nil { | |
logger = logrus.New() | |
} | |
return logger | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment