Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

maclir/function-logger

A wrapper to contain bioler plate code for logging on google cloud functions.

Installations

go get -u github.com/maclir/function-logger

Usage

package something

import (
...
	"cloud.google.com/go/logging"
	flogger "github.com/maclir/function-logger"
)

// reused between function invocations.
var logger *flogger.Logger

func init() {
	var err error
	logger, err = flogger.New()
	if err != nil {
		panic(err)
	}
}

func Something(w http.ResponseWriter, r *http.Request) {
	defer logger.Flush()

	...

	logger.Log(logging.Info, "This is a log")

	...
}

About

Logging with severity for google cloud functions in golang.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages