Skip to content

Instantly share code, notes, and snippets.

@meysampg
Last active July 30, 2019 08:12
Show Gist options
  • Save meysampg/c8119606b490084b0f3162f1f66f9ee9 to your computer and use it in GitHub Desktop.
Save meysampg/c8119606b490084b0f3162f1f66f9ee9 to your computer and use it in GitHub Desktop.
get logger
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