log

package
v1.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package log provides methods for writing logs to Google cloud logging The biggest edge this library brings is grouping logs, it's advisable to take advantage of this behaviour

Index

Constants

This section is empty.

Variables

View Source
var BuiltInExit func(code int) = func(code int) {
	os.Exit(code)
}

BuiltInExit Internally this function just calls os.Exit. Override for testing(Fatal, Fatalf)

View Source
var BuiltInPanic func(v interface{}) = func(v interface{}) {
	panic(v)
}

BuiltInPanic Internally this function just calls panic(). Override for testing(Panic, Panicf)

Functions

func Debug

func Debug(v ...interface{})

Debug send a logging.Debug message to Google cloud logging

func Debugf

func Debugf(format string, v ...interface{})

Debugf send a logging.Debug message to Google cloud logging

func Error

func Error(v ...interface{})

Error send a logging.Error message to Google cloud logging

func Errorf

func Errorf(format string, v ...interface{})

Errorf send a logging.Error message to Google cloud logging

func Fatal

func Fatal(v ...interface{})

Fatal This is equivalent to calling Print followed by os.Exit(1) logged as logging.Alert

func Fatalf

func Fatalf(format string, v ...interface{})

Fatalf This is equivalent to calling Printf followed by os.Exit(1) logged as logging.Alert

func Info

func Info(v ...interface{})

Info send a logging.Info message to Google cloud logging

func Infof

func Infof(format string, v ...interface{})

Infof send a logging.Info message to Google cloud logging

func Panic

func Panic(v ...interface{})

Panic This is equivalent to calling Print followed by panic() logged as logging.Critical

func Panicf

func Panicf(format string, v ...interface{})

Panicf This is equivalent to calling Printf followed by panic() logged as logging.Critical

func Print

func Print(v ...interface{})

Print send a log message to Google cloud logging

func Printf

func Printf(format string, v ...interface{})

Printf send a log message to Google cloud logging

func Println

func Println(v ...interface{})

Println send a log message to Google cloud logging

func Warning

func Warning(v ...interface{})

Warning send a logging.Warning message to Google cloud logging

func Warningf

func Warningf(format string, v ...interface{})

Warningf send a logging.Warning message to Google cloud logging

Types

type GroupResult

type GroupResult struct {
	// contains filtered or unexported fields
}

GroupResult Object returned by creating a new log group/thread.

func Group

func Group(request *http.Request, labels Labels) *GroupResult

Group start a log group for the goroutine that calls this function. A group should be closed after. Use: `defer Group(request, nil).Close()`

func (*GroupResult) Close

func (result *GroupResult) Close()

Close will mark the end of a thread closing the log group. If arguments are provided to the close function, they'll be logged. This can be useful for determining the latency of a request. If there were unfinished writes to alt4 during this thread. This method will wait for the writes to finish Close also logs any panic but doesn't recover.

func (*GroupResult) SetLabel added in v1.1.0

func (result *GroupResult) SetLabel(key string, value interface{}) *GroupResult

func (*GroupResult) SetStatus

func (result *GroupResult) SetStatus(httpStatus int) *GroupResult

type Labels

type Labels map[string]interface{}

Labels are fields that will can be associated to your group log entry. They can be used to filter and better identify your logs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL