logging

package module
v0.0.0-...-93f23d0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 7 Imported by: 94

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppLogger

type AppLogger struct {
	*logrus.Logger
}

func (*AppLogger) Debug

func (a *AppLogger) Debug(ctx context.Context, args ...interface{})

func (*AppLogger) Debugf

func (a *AppLogger) Debugf(ctx context.Context, format string, args ...interface{})

func (*AppLogger) Error

func (a *AppLogger) Error(ctx context.Context, args ...interface{})

func (*AppLogger) Errorf

func (a *AppLogger) Errorf(ctx context.Context, format string, args ...interface{})

func (*AppLogger) Fatal

func (a *AppLogger) Fatal(ctx context.Context, args ...interface{})

func (*AppLogger) Fatalf

func (a *AppLogger) Fatalf(ctx context.Context, format string, args ...interface{})

func (*AppLogger) GenerateRequestID

func (a *AppLogger) GenerateRequestID(prefix string) (string, error)

func (*AppLogger) Info

func (a *AppLogger) Info(ctx context.Context, args ...interface{})

func (*AppLogger) Infof

func (a *AppLogger) Infof(ctx context.Context, format string, args ...interface{})

func (*AppLogger) Level

func (a *AppLogger) Level(level Level)

func (*AppLogger) Notify

func (a *AppLogger) Notify(ctx context.Context, level Level, args ...interface{})

func (*AppLogger) Notifyf

func (a *AppLogger) Notifyf(ctx context.Context, level Level, format string, args ...interface{})

func (*AppLogger) Output

func (a *AppLogger) Output(w io.Writer)

func (*AppLogger) Panic

func (a *AppLogger) Panic(ctx context.Context, args ...interface{})

func (*AppLogger) Panicf

func (a *AppLogger) Panicf(ctx context.Context, format string, args ...interface{})

func (*AppLogger) Warn

func (a *AppLogger) Warn(ctx context.Context, args ...interface{})

func (*AppLogger) Warnf

func (a *AppLogger) Warnf(ctx context.Context, format string, args ...interface{})

func (*AppLogger) WithItems

func (a *AppLogger) WithItems(ctx context.Context, level Level, fields map[string]interface{}, args ...interface{})

func (*AppLogger) WithItemsf

func (a *AppLogger) WithItemsf(ctx context.Context, level Level, fields map[string]interface{}, format string, args ...interface{})

type Level

type Level uint32

Level type

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

	FieldKeyTraceID = "dd.trace_id"
	FieldKeySpanID  = "dd.span_id"
)

type Logger

type Logger interface {
	Debugf(ctx context.Context, format string, args ...interface{})
	Infof(ctx context.Context, format string, args ...interface{})
	Warnf(ctx context.Context, format string, args ...interface{})
	Errorf(ctx context.Context, format string, args ...interface{})
	Fatalf(ctx context.Context, format string, args ...interface{})
	Panicf(ctx context.Context, format string, args ...interface{})

	Debug(ctx context.Context, args ...interface{})
	Info(ctx context.Context, args ...interface{})
	Warn(ctx context.Context, args ...interface{})
	Error(ctx context.Context, args ...interface{})
	Fatal(ctx context.Context, args ...interface{})
	Panic(ctx context.Context, args ...interface{})

	Level(level Level)
	Output(w io.Writer)
	GenerateRequestID(prefix string) (string, error)
	Notify(ctx context.Context, level Level, args ...interface{})
	Notifyf(ctx context.Context, level Level, format string, args ...interface{})
	WithItems(ctx context.Context, level Level, fields map[string]interface{}, args ...interface{})
	WithItemsf(ctx context.Context, level Level, fields map[string]interface{}, format string, args ...interface{})
}

Logger interface

func NewLogger

func NewLogger() Logger

Jump to

Keyboard shortcuts

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