Commit 3dd18d24 authored by Josh Roppo's avatar Josh Roppo

Somewhat hacking Setup function for GCP SeverityFormatter

Setup function which enables logrus to use the SeverityFormatter which
matches GCP's expected logging fields.
parent 337dccb6
......@@ -95,6 +95,20 @@ func SetupLogrus(lvl string) {
}
}
func SetupLogrusSeverityFormatter(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.SeverityFormatter), //Pass via interface?
Hooks: make(logrus.LevelHooks),
Level: loglvl,
}
}
func GetRus() *logrus.Logger {
return rus
}
......
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