This package provides logrus formatter for programs running on Google App Engine. It formats entries printed to stdout/stderr as JSON in a way that allows logging infrastructure to extract meaningful bits of information from them: uses predefined field names, maps severity levels to those expected etc.
import (
// ...
log "github.com/sirupsen/logrus"
"github.com/gelraen/appengine-formatter"
)
func main() {
// ...
log.SetReportCaller(true) // optional, but highly recommended
log.SetFormatter(&appengine.Formatter{
TrimFilenamePrefix: appengine.SourceFileLocation(),
})
log.Printf("Listening on port %s", port)
// ...
}
Resulting log entry looks like this: