stackdriver

package
v0.0.0-...-4ec33cd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const HTTPRequestField = "httpRequest"

Variables

This section is empty.

Functions

func Encoder

func Encoder() zapcore.Encoder

func ErrorReport

func ErrorReport(pc uintptr, file string, line int, ok bool) []zap.Field

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

func ServiceContext(name, version string) zap.Field

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

func SourceLocation(pc uintptr, file string, line int, ok bool) zap.Field

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 WrapCore

func WrapCore(core zapcore.Core, serviceName string, serviceVersion string) *Core

func (*Core) Check

func (*Core) Enabled

func (c *Core) Enabled(l zapcore.Level) bool

func (*Core) Sync

func (c *Core) Sync() error

func (*Core) With

func (c *Core) With(fields []zap.Field) zapcore.Core

func (*Core) Write

func (c *Core) Write(ent zapcore.Entry, fields []zapcore.Field) error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL