logger

package
v0.0.0-...-7341270 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLoggo

func NewLoggo(ops ...OpsFunc) (api.Loggo, error)

func NewRotateLogsHook

func NewRotateLogsHook(ch *RotateLogsConfig, formatter logrus.Formatter) (logrus.Hook, error)

Types

type Config

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

type CtxHook

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

func (*CtxHook) Fire

func (ch *CtxHook) Fire(entry *logrus.Entry) error

func (*CtxHook) Levels

func (ch *CtxHook) Levels() []logrus.Level

type Level

type Level uint32
const (
	// PanicLevel level, highest level of severity. Logs and then calls panic with the
	// message passed to Debug, Info, ...
	PanicLevel Level = iota
	// FatalLevel level. Logs and then calls `logger.Exit(1)`. It will exit even if the
	// logging level is set to Panic.
	FatalLevel
	// ErrorLevel level. Logs. Used for errors that should definitely be noted.
	// Commonly used for hooks to send errors to an error tracking service.
	ErrorLevel
	// WarnLevel level. Non-critical entries that deserve eyes.
	WarnLevel
	// InfoLevel level. General operational entries about what's going on inside the
	// application.
	InfoLevel
	// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
	DebugLevel
	// TraceLevel level. Designates finer-grained informational events than the Debug.
	TraceLevel
)

These are the different logging levels. You can set the logging level to log

type LoggoImpl

type LoggoImpl struct {
	*Config
	// contains filtered or unexported fields
}

func (*LoggoImpl) CtxDebug

func (l *LoggoImpl) CtxDebug(ctx context.Context, format string, v ...interface{})

func (*LoggoImpl) CtxDebugl

func (l *LoggoImpl) CtxDebugl(ctx context.Context, location string, format string, v ...interface{})

func (*LoggoImpl) CtxError

func (l *LoggoImpl) CtxError(ctx context.Context, format string, v ...interface{})

func (*LoggoImpl) CtxErrorl

func (l *LoggoImpl) CtxErrorl(ctx context.Context, location string, format string, v ...interface{})

func (*LoggoImpl) CtxFatal

func (l *LoggoImpl) CtxFatal(ctx context.Context, format string, v ...interface{})

func (*LoggoImpl) CtxInfo

func (l *LoggoImpl) CtxInfo(ctx context.Context, format string, v ...interface{})

func (*LoggoImpl) CtxInfol

func (l *LoggoImpl) CtxInfol(ctx context.Context, location string, format string, v ...interface{})

func (*LoggoImpl) CtxTrace

func (l *LoggoImpl) CtxTrace(ctx context.Context, format string, v ...interface{})

func (*LoggoImpl) CtxTracel

func (l *LoggoImpl) CtxTracel(ctx context.Context, location string, format string, v ...interface{})

func (*LoggoImpl) CtxWarn

func (l *LoggoImpl) CtxWarn(ctx context.Context, format string, v ...interface{})

func (*LoggoImpl) CtxWarnl

func (l *LoggoImpl) CtxWarnl(ctx context.Context, location string, format string, v ...interface{})

func (*LoggoImpl) CtxflFatal

func (l *LoggoImpl) CtxflFatal(ctx context.Context, location string, format string, v ...interface{})

func (*LoggoImpl) Debug

func (l *LoggoImpl) Debug(format string, v ...interface{})

func (*LoggoImpl) Error

func (l *LoggoImpl) Error(format string, v ...interface{})

func (*LoggoImpl) Fatal

func (l *LoggoImpl) Fatal(format string, v ...interface{})

func (*LoggoImpl) Info

func (l *LoggoImpl) Info(format string, v ...interface{})

func (*LoggoImpl) Trace

func (l *LoggoImpl) Trace(format string, v ...interface{})

func (*LoggoImpl) Warn

func (l *LoggoImpl) Warn(format string, v ...interface{})

type OpsFunc

type OpsFunc func(cfg *Config)

func WithCtxValue

func WithCtxValue(f func(ctx context.Context) map[string]interface{}) OpsFunc

func WithDisableColor

func WithDisableColor() OpsFunc

func WithLevel

func WithLevel(level Level) OpsFunc

func WithReportCaller

func WithReportCaller(skipPoint ...int) OpsFunc

func WithRotateLogs

func WithRotateLogs(conf *RotateLogsConfig) OpsFunc

type RotateLogsConfig

type RotateLogsConfig struct {
	LogFilePrefix string
	RotationSize  int64
	RotationCount uint
	RotationTime  time.Duration
	MaxAge        time.Duration
}

Jump to

Keyboard shortcuts

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