[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Latest commit

 

History

History

logrus

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Logrus formatter for Oops

import oopslogrus "github.com/samber/oops/loggers/logrus"

func init() {
    logrus.SetFormatter(
        oopslogrus.NewOopsFormatter(
	    &logrus.JSONFormatter{},
        )
    )
}

func main() {
    err := oops.
        With("driver", "postgresql").
        With("query", query).
        With("query.duration", queryDuration).
        Errorf("could not fetch user")

    if err != nil {
    	logrus.WithError(err).Error(err)
    }
}