Skip to content

A simple wrapper of the standard Go log package that adds structured logging suitable for delivering Google Cloud Function logs to Google Cloud Logging.

License

Notifications You must be signed in to change notification settings

emanuelem/gcflogger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gcflogger

This package is a simple wrapper of the standard Go log package that adds structured logging suitable for delivering Google Cloud Function logs to Google Cloud Logging.

Install

go get -u github.com/emanuelem/gcflogger

Sample usage

package main

import (
	"context"

	"github.com/emanuelem/gcflogger"
)

func main() {
	ctx := context.Background()
	logger := gcflogger.New(ctx)

	logger.Notice("I am a notice!")
	code := 300
	logger.Noticef("I am also a notice with code %v!", code)
}

The available methods correspond to the severity levels:

Enum Code Description
DEFAULT 0 The log entry has no assigned severity level.
DEBUG 100 Debug or trace information.
INFO 200 Routine information, such as ongoing status or performance.
NOTICE 300 Normal but significant events, such as start up, shut down, or a configuration change.
WARNING 400 Warning events might cause problems.
ERROR 500 Error events are likely to cause problems.
CRITICAL 600 Critical events cause more severe problems or outages.
ALERT 700 A person must take an action immediately.
EMERGENCY 800 One or more systems are unusable.

License

GPLv3 - See LICENSE file

About

A simple wrapper of the standard Go log package that adds structured logging suitable for delivering Google Cloud Function logs to Google Cloud Logging.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages