Commit f550ff5c authored by Josh Roppo's avatar Josh Roppo

Defaulting to use the JSON SeverityFormatter for logrus logging

Makes for clean accomodation of GKE/GCP logging.
parent 22a900cb
......@@ -87,24 +87,8 @@ func SetupLoggingFile(f *os.File, lvl string) {
}
// SetupLogrus initializes an internal logrus.Logger object
// which will be used for formatting JSON log messages
func SetupLogrus(lvl string) {
loglvl, err := logrus.ParseLevel(lvl)
if err != nil {
fmt.Printf("error parsing log level: %v", err)
}
rus = &logrus.Logger{
Out: os.Stdout,
Formatter: new(logrus.JSONFormatter),
Hooks: make(logrus.LevelHooks),
Level: loglvl,
}
}
// SetupLogrusSeverityFormatter initializes an internal logrus.Logger object
// with the GCP log format compatible SeverityFormatter.
func SetupLogrusSeverityFormatter(lvl string) {
func SetupLogrus(lvl string) {
loglvl, err := logrus.ParseLevel(lvl)
if err != nil {
fmt.Printf("error parsing log level: %v", err)
......@@ -112,7 +96,7 @@ func SetupLogrusSeverityFormatter(lvl string) {
rus = &logrus.Logger{
Out: os.Stdout,
Formatter: new(logrus.SeverityFormatter), //Pass via interface?
Formatter: new(logrus.SeverityFormatter), //Possible to pass via interface?
Hooks: make(logrus.LevelHooks),
Level: loglvl,
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment