logger

package
v0.18.4 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ctx added in v0.10.3

func Ctx(ctx context.Context, info *grpc.UnaryServerInfo, code codes.Code) zapcore.Field

Ctx ...

func Init

func Init(opts Opts) (logger *zap.Logger, err error)

Init allocates new logger based on given options.

func NewStackdriverConfig added in v0.10.3

func NewStackdriverConfig() zap.Config

NewStackdriverConfig ...

func NewStackdriverEncoderConfig added in v0.10.3

func NewStackdriverEncoderConfig() zapcore.EncoderConfig

Types

type Context added in v0.10.3

type Context struct {
	HTTPRequest HTTPRequest
	User        string
	// contains filtered or unexported fields
}

func (Context) MarshalLogObject added in v0.10.3

func (c Context) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore ObjectMarshaler.

type Encoder added in v0.10.3

type Encoder struct {
	zapcore.Encoder
}

func (*Encoder) Clone added in v0.10.3

func (e *Encoder) Clone() zapcore.Encoder

func (*Encoder) EncodeEntry added in v0.10.3

func (e *Encoder) EncodeEntry(ent zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)

type HTTPRequest added in v0.10.3

type HTTPRequest struct {
	Method             string `json:"method"`
	URL                string `json:"url"`
	UserAgent          string `json:"userAgent"`
	Referrer           string `json:"referrer"`
	ResponseStatusCode string `json:"responseStatusCode"`
	RemoteIP           string `json:"remoteIp"`
}

func (HTTPRequest) MarshalLogObject added in v0.10.3

func (hr HTTPRequest) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore ObjectMarshaler.

type Opts

type Opts struct {
	Environment string
	Version     string
	Level       string
}

type ServiceContext added in v0.10.3

type ServiceContext struct {
	Service string `json:"service"`
	Version string `json:"version"`
}

func (ServiceContext) MarshalLogObject added in v0.10.3

func (sc ServiceContext) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore ObjectMarshaler.

Jump to

Keyboard shortcuts

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