Documentation ¶
Index ¶
- Constants
- func Encoder() zapcore.Encoder
- func ErrorReport(pc uintptr, file string, line int, ok bool) []zap.Field
- func HTTP(req *HTTPRequest) zap.Field
- func ServiceContext(name, version string) zap.Field
- func SourceLocation(pc uintptr, file string, line int, ok bool) zap.Field
- type Core
- type HTTPRequest
Constants ¶
View Source
const HTTPRequestField = "httpRequest"
Variables ¶
This section is empty.
Functions ¶
func ErrorReport ¶
ErrorReport adds the correct Stackdriver "context" field for getting the log line reported as error.
see: https://cloud.google.com/error-reporting/docs/formatting-error-messages
func HTTP ¶
func HTTP(req *HTTPRequest) zap.Field
func ServiceContext ¶
ServiceContext adds the correct service information adding the log line It is a required field if an error needs to be reported.
see: https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext see: https://cloud.google.com/error-reporting/docs/formatting-error-messages
func SourceLocation ¶
SourceLocation adds the correct Stackdriver "SourceLocation" field.
see: https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#LogEntrySourceLocation
Types ¶
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
func (*Core) Check ¶
func (c *Core) Check(e zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry
type HTTPRequest ¶
type HTTPRequest struct { RequestMethod string `json:"requestMethod"` RequestURL string `json:"requestUrl"` RequestSize string `json:"requestSize"` Latency string `json:"latency"` ResponseSize string `json:"responseSize"` UserAgent string `json:"userAgent"` RemoteIP string `json:"remoteIp"` ServerIP string `json:"serverIp"` Referer string `json:"referer"` Protocol string `json:"protocol"` Status int `json:"status"` }
func (*HTTPRequest) MarshalLogObject ¶
func (req *HTTPRequest) MarshalLogObject(enc zapcore.ObjectEncoder) error
Click to show internal directories.
Click to hide internal directories.