Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultFormat = StackdriverFormat
DefaultFormat is Stackdriver.
Functions ¶
func DisableTimestampFormat ¶
func PrettyPrintFormat ¶
func StackdriverFormat ¶
StackdriverFormat maps values to be recognized by the Google Cloud Platform. https://cloud.google.com/logging/docs/agent/configuration#special-fields
Types ¶
type Formatter ¶
type Formatter struct {
// DisableTimestamp allows disabling automatic timestamps in output
DisableTimestamp bool
// TimestampFormat sets the format used for marshaling timestamps.
TimestampFormat func(logrus.Fields, time.Time) error
// SeverityMap allows for customizing the names for keys of the log level field.
SeverityMap map[string]string
// PrettyPrint will indent all json logs
PrettyPrint bool
}
Formatter that is called on by logrus.
func NewFormatter ¶
NewFormatter with optional options. Defaults to the Stackdriver option.
type HTTPRequest ¶
type HTTPRequest struct {
// Request is the http.Request passed to the handler.
Request *http.Request
// RequestSize is the size of the HTTP request message in bytes, including
// the request headers and the request body.
RequestSize int64
// Status is the response code indicating the status of the response.
// Examples: 200, 404.
Status int
// ResponseSize is the size of the HTTP response message sent back to the client, in bytes,
// including the response headers and the response body.
ResponseSize int64
// Latency is the request processing latency on the server, from the time the request was
// received until the response was sent.
Latency time.Duration
// LocalIP is the IP address (IPv4 or IPv6) of the origin server that the request
// was sent to.
LocalIP string
// RemoteIP is the IP address (IPv4 or IPv6) of the client that issued the
// HTTP request. Examples: "192.168.1.1", "FE80::0202:B3FF:FE1E:8329".
RemoteIP string
// CacheHit reports whether an entity was served from cache (with or without
// validation).
CacheHit bool
// CacheValidatedWithOriginServer reports whether the response was
// validated with the origin server before being served from cache. This
// field is only meaningful if CacheHit is true.
CacheValidatedWithOriginServer bool
}
HTTPRequest contains an http.Request as well as additional information about the request and its response. https://github.com/googleapis/google-cloud-go/blob/v0.39.0/logging/logging.go#L617
func (HTTPRequest) MarshalJSON ¶
func (r HTTPRequest) MarshalJSON() ([]byte, error)
Click to show internal directories.
Click to hide internal directories.