logger

package
v0.0.0-...-59d7cbf Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

README

Logger - Read Here

Documentation

Index

Constants

View Source
const (
	// Standard keys for structured logging.
	TimestampKey    = "ts"
	LevelKey        = "level"
	ErrorKey        = "error"
	MessageKey      = "msg"
	EventType       = "eventType"
	ChildEventIDKey = "childEventId"
	EventIDKey      = "eventId"
	EventStatusKey  = "status"
	TimeTakenMSKey  = "timeTakenMS"
	WaitTimeMSKey   = "waitTimeMS"
	QueueTimeMSKey  = "queueTimeMS"
	QueueLengthKey  = "queueLen"
	NameKey         = "name"
	OperationKey    = "op"
	TypeKey         = "type"
	DeleteValue     = "delete"
	CreateValue     = "create"
	UpdateValue     = "update"
	EnvKey          = "env"
	RevisionKey     = "revision"

	ControllerNameKey     = "controller"
	ResourceIdentifierKey = "obj"
	WorkloadIdentifierKey = "identity"
	NamespaceKey          = "namespace"
	LabelsKey             = "labels"
	LabelSelectorKey      = "labelSelector"
	ClusterKey            = "cluster"
	NamespaceSecretKey    = "namespace/secret"
	FilterNameKey         = "filterName"
	FilterTypeKey         = "filterType"
	HandlerNameKey        = "handlerName"

	DependentIdentityKey = "dependentIdentity"
	DependentsKey        = "dependents"
	SourceAssetKey       = "sourceAsset"
	DestinationAssetKey  = "destinationAsset"

	DeployNameKey  = "deployName"
	RolloutNameKey = "rolloutName"

	RouteNameKey = "routeName"
)

Variables

View Source
var Log = NewLogger()

Log is a global logger for global context logging.

Functions

func EncoderType

func EncoderType() string

func GetEncoderConfig

func GetEncoderConfig() zapcore.EncoderConfig

func IsDevelopment

func IsDevelopment() bool

Types

type LogLevel

type LogLevel string
const (
	TraceLevel LogLevel = "trace"
	DebugLevel LogLevel = "debug"
	InfoLevel  LogLevel = "info"
	WarnLevel  LogLevel = "warn"
	ErrorLevel LogLevel = "error"
	FatalLevel LogLevel = "fatal"
)

func (LogLevel) String

func (l LogLevel) String() string

type Logger

type Logger interface {
	Trace(msg string)

	Tracef(msg string, args ...interface{})

	Debug(msg string)

	Debugf(msg string, args ...interface{})

	Info(msg string)

	Infof(msg string, args ...interface{})

	Warn(msg string)

	Warnf(msg string, args ...interface{})

	Error(msg string)

	Errorf(msg string, args ...interface{})

	Fatal(msg string)

	Fatalf(msg string, args ...interface{})

	Str(key string, value string) Logger

	Int(key string, value int) Logger

	Any(key string, value interface{}) Logger

	Bool(key string, value bool) Logger

	WithStr(key string, value string) Logger

	WithBool(key string, value bool) Logger

	WithInt(key string, value int) Logger

	With(key string, value interface{}) Logger

	// SetLogLevel sets the log level for the logger at global level
	SetLogLevel(level string)

	GetLogLevel() string

	Hook(hook func(level string, msg string)) Logger

	// Error Handler
	HandleError(err error)
}

func NewLogger

func NewLogger() Logger

func NewZapLogger

func NewZapLogger() Logger

func NewZeroLogger

func NewZeroLogger() Logger

type ZapLogger

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

func (*ZapLogger) Any

func (l *ZapLogger) Any(key string, value interface{}) Logger

func (*ZapLogger) Bool

func (l *ZapLogger) Bool(key string, value bool) Logger

func (*ZapLogger) Debug

func (l *ZapLogger) Debug(msg string)

func (*ZapLogger) Debugf

func (l *ZapLogger) Debugf(msg string, args ...interface{})

func (*ZapLogger) Error

func (l *ZapLogger) Error(msg string)

func (*ZapLogger) Errorf

func (l *ZapLogger) Errorf(msg string, args ...interface{})

func (*ZapLogger) Fatal

func (l *ZapLogger) Fatal(msg string)

func (*ZapLogger) Fatalf

func (l *ZapLogger) Fatalf(msg string, args ...interface{})

func (*ZapLogger) GetLogLevel

func (l *ZapLogger) GetLogLevel() string

func (*ZapLogger) HandleError

func (l *ZapLogger) HandleError(err error)

func (*ZapLogger) Hook

func (l *ZapLogger) Hook(hookFunc func(level string, msg string)) Logger

func (*ZapLogger) Info

func (l *ZapLogger) Info(msg string)

func (*ZapLogger) Infof

func (l *ZapLogger) Infof(msg string, args ...interface{})

func (*ZapLogger) Int

func (l *ZapLogger) Int(key string, value int) Logger

func (ZapLogger) SetLogLevel

func (ZapLogger) SetLogLevel(level string)

func (*ZapLogger) Str

func (l *ZapLogger) Str(key string, value string) Logger

func (*ZapLogger) Trace

func (l *ZapLogger) Trace(msg string)

func (*ZapLogger) Tracef

func (l *ZapLogger) Tracef(msg string, args ...interface{})

func (*ZapLogger) Warn

func (l *ZapLogger) Warn(msg string)

func (*ZapLogger) Warnf

func (l *ZapLogger) Warnf(msg string, args ...interface{})

func (*ZapLogger) With

func (l *ZapLogger) With(key string, value interface{}) Logger

func (*ZapLogger) WithBool

func (l *ZapLogger) WithBool(key string, value bool) Logger

func (*ZapLogger) WithInt

func (l *ZapLogger) WithInt(key string, value int) Logger

func (*ZapLogger) WithStr

func (l *ZapLogger) WithStr(key string, value string) Logger

type ZeroLogger

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

func (*ZeroLogger) Any

func (z *ZeroLogger) Any(key string, value interface{}) Logger

func (*ZeroLogger) Bool

func (z *ZeroLogger) Bool(key string, value bool) Logger

func (*ZeroLogger) Debug

func (z *ZeroLogger) Debug(msg string)

func (*ZeroLogger) Debugf

func (z *ZeroLogger) Debugf(msg string, args ...interface{})

func (*ZeroLogger) Error

func (z *ZeroLogger) Error(msg string)

func (*ZeroLogger) Errorf

func (z *ZeroLogger) Errorf(msg string, args ...interface{})

func (*ZeroLogger) Fatal

func (z *ZeroLogger) Fatal(msg string)

func (*ZeroLogger) Fatalf

func (z *ZeroLogger) Fatalf(msg string, args ...interface{})

func (*ZeroLogger) GetLogLevel

func (z *ZeroLogger) GetLogLevel() string

func (*ZeroLogger) HandleError

func (z *ZeroLogger) HandleError(err error)

func (*ZeroLogger) Hook

func (z *ZeroLogger) Hook(hookFunc func(level string, msg string)) Logger

func (*ZeroLogger) Info

func (z *ZeroLogger) Info(msg string)

func (*ZeroLogger) Infof

func (z *ZeroLogger) Infof(msg string, args ...interface{})

func (*ZeroLogger) Int

func (z *ZeroLogger) Int(key string, value int) Logger

func (*ZeroLogger) SetLogLevel

func (z *ZeroLogger) SetLogLevel(level string)

func (*ZeroLogger) Str

func (z *ZeroLogger) Str(key string, value string) Logger

func (*ZeroLogger) Trace

func (z *ZeroLogger) Trace(msg string)

func (*ZeroLogger) Tracef

func (z *ZeroLogger) Tracef(msg string, args ...interface{})

func (*ZeroLogger) Warn

func (z *ZeroLogger) Warn(msg string)

func (*ZeroLogger) Warnf

func (z *ZeroLogger) Warnf(msg string, args ...interface{})

func (*ZeroLogger) With

func (z *ZeroLogger) With(key string, value interface{}) Logger

func (*ZeroLogger) WithBool

func (z *ZeroLogger) WithBool(key string, value bool) Logger

func (*ZeroLogger) WithInt

func (z *ZeroLogger) WithInt(key string, value int) Logger

func (*ZeroLogger) WithStr

func (z *ZeroLogger) WithStr(key string, value string) Logger

Jump to

Keyboard shortcuts

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