Documentation ¶
Overview ¶
Package gcloudlogging provides special encoding, configuration for the encoder, and other constructs for go.uber.org/zap that make Cloud Logging understand its logs.
All Storj-run applications will most certainly use the Cloud Logging agent instead of directly feeding Cloud Logging with LogEntries. This means we need to comply with the specification to make the message, level, time, and other fields gain special meaning that later allows us to construct powerful queries. Reference: https://cloud.google.com/logging/docs/structured-logging.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogHTTPRequest ¶
func LogHTTPRequest(req *HTTPRequest) zapcore.Field
LogHTTPRequest returns a zapcore.Field for HTTPRequest.
func LogOperation ¶
LogOperation returns a zapcore.field for Operation.
func NewEncoder ¶
func NewEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
NewEncoder is like zapcore.NewJSONEncoder, but it moves fields and several keys in the log line so that Cloud Logging understands them better.
func NewEncoderConfig ¶
func NewEncoderConfig() zapcore.EncoderConfig
NewEncoderConfig creates zapcore.EncoderConfig suited for Cloud Logging.
Types ¶
type HTTPRequest ¶
type HTTPRequest struct { RequestMethod string RequestURL string RequestSize int64 Status int ResponseSize int64 UserAgent string RemoteIP string ServerIP string Referer string Latency time.Duration CacheLookup bool CacheHit bool CacheValidatedWithOriginServer bool CacheFillBytes int64 Protocol string }
HTTPRequest represents HttpRequest field. See: https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#httprequest
func (*HTTPRequest) MarshalLogObject ¶
func (req *HTTPRequest) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject implements zapcore.ObjectMarshaler. All fields are optional.
type Operation ¶
Operation represents LogEntryOperation field. See: https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#LogEntryOperation
func (*Operation) MarshalLogObject ¶
func (op *Operation) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject implements zapcore.ObjectMarshaler. All fields are optional.