Skip to content

Commit

Permalink
Send standard logger's output to logrus (gomods#1912)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesep authored Feb 5, 2024
1 parent 2ac4289 commit cffffc0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ func main() {

logger := athenslog.New(conf.CloudRuntime, logLvl)

// Turn standard logger output into logrus Errors.
logrusErrorWriter := logger.WriterLevel(logrus.ErrorLevel)
defer func() {
if err := logrusErrorWriter.Close(); err != nil {
logger.WithError(err).Warn("Could not close logrus writer pipe")
}
}()
stdlog.SetOutput(logrusErrorWriter)
stdlog.SetFlags(stdlog.Flags() &^ (stdlog.Ldate | stdlog.Ltime))

handler, err := actions.App(logger, conf)
if err != nil {
logger.WithError(err).Fatal("Could not create App")
Expand Down

0 comments on commit cffffc0

Please sign in to comment.