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 ¶
- Variables
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func Panic(v ...interface{})
- func Panicf(format string, v ...interface{})
- func Print(v ...interface{})
- func Printf(format string, v ...interface{})
- func Println(v ...interface{})
- func Warning(v ...interface{})
- func Warningf(format string, v ...interface{})
- type GroupResult
- type Labels
- func (labels Labels) Debug(v ...interface{})
- func (labels Labels) Debugf(format string, v ...interface{})
- func (labels Labels) Error(v ...interface{})
- func (labels Labels) Errorf(format string, v ...interface{})
- func (labels Labels) Fatal(v ...interface{})
- func (labels Labels) Fatalf(format string, v ...interface{})
- func (labels Labels) Group(url string, method string) *GroupResult
- func (labels Labels) Info(v ...interface{})
- func (labels Labels) Infof(format string, v ...interface{})
- func (labels Labels) Panic(v ...interface{})
- func (labels Labels) Panicf(format string, v ...interface{})
- func (labels Labels) Print(v ...interface{})
- func (labels Labels) Printf(format string, v ...interface{})
- func (labels Labels) Println(v ...interface{})
- func (labels Labels) Warning(v ...interface{})
- func (labels Labels) Warningf(format string, v ...interface{})
Constants ¶
This section is empty.
Variables ¶
var BuiltInExit func(code int) = func(code int) { os.Exit(code) }
BuiltInExit Internally this function just calls os.Exit. Override for testing(Fatal, Fatalf)
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 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 Printf ¶
func Printf(format string, v ...interface{})
Printf send a log 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) Error ¶
func (labels Labels) Error(v ...interface{})
Error 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 ¶
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) Panic ¶
func (labels Labels) Panic(v ...interface{})
Panic This is equivalent to calling Print followed by panic() logged as logging.Critical
func (Labels) Panicf ¶
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) Println ¶
func (labels Labels) Println(v ...interface{})
Println send labels and a log message to Google cloud logging