logger

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 9 Imported by: 6

Documentation

Index

Constants

View Source
const (
	LogTag        = "_BASE_."
	AccessLog     = "_MSG_.access"
	ErrorLog      = "_MSG_.error"
	UpstreamLog   = "_MSG_.upstream"
	DownstreamLog = "_MSG_.downstream"
	StreamingLog  = "_MSG_.streaming"

	Consumed      = "consumed"
	LogConsumed   = LogTag + Consumed
	LogPath       = LogTag + "path"
	LogRequest    = LogTag + "request"
	LogResponse   = LogTag + "response"
	LogUpstream   = LogTag + "upstream"
	LogDownstream = LogTag + "downstream"
	LogSecret     = LogTag + "secret"
	LogError      = LogTag + "error"
)

Variables

This section is empty.

Functions

func ContextWithLogger

func ContextWithLogger(ctx context.Context) context.Context

func Debug

func Debug(msg string, c Content)

func Error

func Error(msg string, c Content)

func Fatal

func Fatal(msg string, c Content)

func Info

func Info(msg string, c Content)

func RegisterImplementor

func RegisterImplementor(log Logger)

RegisterImplementor registers the logger service implementor.

func StreamServerInterceptor

func StreamServerInterceptor() grpc.StreamServerInterceptor

StreamServerInterceptor returns a new streaming server interceptor for access log.

func UnaryServerInterceptor

func UnaryServerInterceptor() grpc.UnaryServerInterceptor

UnaryServerInterceptor returns a new unary server interceptor for access log.

func Warn

func Warn(msg string, c Content)

Types

type Content

type Content map[string]interface{}

type Helper

type Helper struct {
	Logger
	// contains filtered or unexported fields
}

func ContextLogger

func ContextLogger(ctx context.Context) *Helper

func (*Helper) Debug

func (h *Helper) Debug(msg string, c Content)

func (*Helper) Error

func (h *Helper) Error(msg string, c Content)

func (*Helper) Fatal

func (h *Helper) Fatal(msg string, c Content)

func (*Helper) Info

func (h *Helper) Info(msg string, c Content)

func (*Helper) Warn

func (h *Helper) Warn(msg string, c Content)

type Level

type Level int
const (
	DebugLevel Level = iota - 1
	InfoLevel
	WarnLevel
	ErrorLevel
	FatalLevel
)

func (Level) String

func (l Level) String() string

type Logger

type Logger interface {
	UpdateLevel(level Level)
	Log(level Level, md *common.Metadata, msg string, c Content)
}

Logger interface.

func Implementor

func Implementor() Logger

Implementor returns the logger service implementor.

Jump to

Keyboard shortcuts

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