log

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: BSD-3-Clause Imports: 8 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(url string, method string) *GroupResult

Group start a log group for the goroutine that calls this function. A group should be closed after. Use: `defer Group(...).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) SetRequest

func (result *GroupResult) SetRequest(request *http.Request) *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 log entry. They can be used to filter and better identify your logs.

func (Labels) Debug

func (labels Labels) Debug(v ...interface{})

Debug send labels and a logging.Debug message to Google cloud logging

func (Labels) Debugf

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

Debugf send labels and a logging.Debug message to Google cloud logging

func (Labels) Error

func (labels Labels) Error(v ...interface{})

Error send labels and a logging.Error message to Google cloud logging

func (Labels) Errorf

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

Errorf send labels and a logging.Error message to Google cloud logging

func (Labels) Fatal

func (labels Labels) Fatal(v ...interface{})

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

func (Labels) Fatalf

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

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

func (Labels) Group

func (labels Labels) Group(url string, method string) *GroupResult

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

func (Labels) Info

func (labels Labels) Info(v ...interface{})

Info send labels and a logging.Info message to Google cloud logging

func (Labels) Infof

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

Infof send labels and a logging.Info message to Google cloud logging

func (Labels) Panic

func (labels Labels) Panic(v ...interface{})

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

func (Labels) Panicf

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

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

func (Labels) Print

func (labels Labels) Print(v ...interface{})

Print send labels and a log message to Google cloud logging

func (Labels) Printf

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

Printf send labels and a log message to Google cloud logging

func (Labels) Println

func (labels Labels) Println(v ...interface{})

Println send labels and a log message to Google cloud logging

func (Labels) Warning

func (labels Labels) Warning(v ...interface{})

Warning send labels and a logging.Warning message to Google cloud logging

func (Labels) Warningf

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

Warningf send labels and a logging.Warning message to Google cloud logging

Jump to

Keyboard shortcuts

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