log

package
v0.0.0-...-815ad63 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomEncodeLevel

func CustomEncodeLevel(level zapcore.Level, enc zapcore.PrimitiveArrayEncoder)

func EnsureCorrelationID

func EnsureCorrelationID(ctx context.Context) (string, context.Context)

Types

type CallerHolder

type CallerHolder struct {
	Caller string
}

type GRPC

type GRPC struct {
	// contains filtered or unexported fields
}

func NewGRPC

func NewGRPC(c context.Context, log *Log, start time.Time, path string, requestBody any, responseBody any, err error) *GRPC

func (*GRPC) MarshalLogObject

func (h *GRPC) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (*GRPC) Write

func (h *GRPC) Write()

type HTTP

type HTTP struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

func NewHTTP

func NewHTTP(w http.ResponseWriter, c context.Context, log *Log, start time.Time, method string, url *url.URL, contentType, userAgent string, requestBody []byte) *HTTP

func (*HTTP) MarshalLogObject

func (h *HTTP) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (*HTTP) Write

func (h *HTTP) Write(buf []byte) (int, error)

func (*HTTP) WriteHeader

func (h *HTTP) WriteHeader(code int)

type Key

type Key string
const (
	KeyCorrelationIDContext Key = "correlation_id"
	KeyCallerHolderContext  Key = "caller"
)

func (Key) String

func (k Key) String() string

type Log

type Log struct {
	CorrelationID string
	Path          string
	QueryString   *string
	// contains filtered or unexported fields
}

func Get

func Get(logEntity configEntity.Log, module configEntity.Module) *Log

func (*Log) Debug

func (l *Log) Debug(msg string)

func (*Log) Error

func (l *Log) Error(msg string)

func (*Log) Errorf

func (l *Log) Errorf(format string, args ...any)

func (*Log) Info

func (l *Log) Info(msg string)

func (*Log) Warn

func (l *Log) Warn(msg string)

func (*Log) ZapFields

func (l *Log) ZapFields() (fields []zap.Field)

Jump to

Keyboard shortcuts

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