logger

package
v0.0.0-...-9b598c7 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Logger is a logger with a background context

Functions

func GetOperationID

func GetOperationID(ctx context.Context) string

GetOperationID get operationID of the context

func OperationIDMiddleware

func OperationIDMiddleware(handler http.Handler) http.Handler

Middleware wraps the given HTTP handler so that the details of the request are sent to the log.

func WithOpID

func WithOpID(ctx context.Context) context.Context

Types

type LogEvent

type LogEvent struct {
	Type        string
	Description string
}

func NewLogEvent

func NewLogEvent(eventType string, description ...string) LogEvent

func NewLogEventFromString

func NewLogEventFromString(eventTypeAndDescription string) (logEvent LogEvent)

func (LogEvent) ToString

func (l LogEvent) ToString() string

type LoggerKeys

type LoggerKeys string
const (
	ActionKey       LoggerKeys = "Action"
	ActionResultKey LoggerKeys = "EventResult"
	RemoteAddrKey   LoggerKeys = "RemoteAddr"

	ActionFailed  LoggerKeys = "failed"
	ActionSuccess LoggerKeys = "success"
)

type OperationIDKey

type OperationIDKey string
const OpIDHeader OperationIDKey = "X-Operation-ID"
const OpIDKey OperationIDKey = "opID"

type UHCLogger

type UHCLogger interface {
	V(level int32) UHCLogger
	Infof(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Error(err error)
	Fatalf(format string, args ...interface{})
}

func NewUHCLogger

func NewUHCLogger(ctx context.Context) UHCLogger

NewUHCLogger creates a new logger instance with a default verbosity of 1

Jump to

Keyboard shortcuts

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