Skip to content

imax9000/appengine-formatter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logrus formatter for App Engine

GoDoc

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.

Example

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:

example log entry

About

Logrus formatter for Google App Engine

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages