Documentation ¶
Index ¶
- Constants
- type Context
- type Fields
- type Log
- func (l *Log) AddCallerSkip(skip int)
- func (l *Log) Debug(message string)
- func (l *Log) Debugf(message string, args ...interface{})
- func (l *Log) Error(message string)
- func (l *Log) Errorf(message string, args ...interface{})
- func (l *Log) Fatal(message string)
- func (l *Log) Fatalf(message string, args ...interface{})
- func (l *Log) Info(message string)
- func (l *Log) Infof(message string, args ...interface{})
- func (l *Log) Warn(message string)
- func (l *Log) Warnf(message string, args ...interface{})
- func (l *Log) With(fields Fields) *Log
- func (l *Log) WithLevel(logLevel severity) *Log
- func (l *Log) WithOutput(w io.Writer) *Log
- func (l *Log) WithTrace(traceID string, spanID string, sampled bool, projectName string) *Log
- type Payload
- type ReportLocation
- type ServiceContext
Constants ¶
const ( DEBUG severity = iota INFO WARN ERROR CRITICAL )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { Data Fields `json:"data,omitempty"` ReportLocation *ReportLocation `json:"reportLocation,omitempty"` }
Context is required by the Stackdriver Error format
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log is the main type for the logger package
func (*Log) AddCallerSkip ¶ added in v1.2.1
AddCallerSkip increases the number of callers skipped by caller annotation. When building wrappers around the Logger, supplying this value prevents logger from always reporting the wrapper code as the caller.
func (*Log) Fatal ¶
Fatal is equivalent to Error() followed by a call to os.Exit(1). It prints out a message with CRITICAL severity level
func (*Log) Fatalf ¶
Fatalf is equivalent to Errorf() followed by a call to os.Exit(1). It prints out a message with CRITICAL severity level
func (*Log) With ¶
With is used as a chained method to specify which values go in the log entry's context
func (*Log) WithLevel ¶ added in v1.1.0
WithLevel creates a copy of a Log with a different log level
func (*Log) WithOutput ¶
WithOutput creates a copy of a Log with a different output.
type Payload ¶
type Payload struct { Severity string `json:"severity"` EventTime string `json:"eventTime"` Caller string `json:"caller,omitempty"` Message string `json:"message"` ServiceContext *ServiceContext `json:"serviceContext,omitempty"` Context *Context `json:"context,omitempty"` Stacktrace string `json:"stacktrace,omitempty"` // contains filtered or unexported fields }
Payload groups all the data for a log entry
type ReportLocation ¶
type ReportLocation struct { FilePath string `json:"filePath"` FunctionName string `json:"functionName"` LineNumber int `json:"lineNumber"` }
ReportLocation is required by the Stackdriver Error format
type ServiceContext ¶
type ServiceContext struct { Service string `json:"service,omitempty"` Version string `json:"version,omitempty"` }
ServiceContext is required by the Stackdriver Error format