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
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(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