logger

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: Apache-2.0 Imports: 14 Imported by: 8

Documentation

Index

Constants

View Source
const (
	VersionKey      = "version"
	SpanTitleKey    = "title"
	SpanFunctionKey = "function"
)

Key constants

Variables

This section is empty.

Functions

func AddHook

func AddHook(hook logrus.Hook)

AddHook adds a hook to the logger

func Debug

func Debug(ctx context.Context, args ...any)

Debug logs debug message

func Debugf

func Debugf(ctx context.Context, format string, args ...any)

Debugf logs debug message with format

func EnsureTraceID

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

EnsureTraceID ensures that a trace ID exists in the context.

func Error

func Error(ctx context.Context, args ...any)

Error logs error message

func Errorf

func Errorf(ctx context.Context, format string, args ...any)

Errorf logs error message with format

func Fatal

func Fatal(ctx context.Context, args ...any)

Fatal logs fatal message

func Fatalf

func Fatalf(ctx context.Context, format string, args ...any)

Fatalf logs fatal message with format

func Info

func Info(ctx context.Context, args ...any)

Info logs info message

func Infof

func Infof(ctx context.Context, format string, args ...any)

Infof logs info message with format

func New

func New(c *config.Logger) (func(), error)

New creates new logger

func Panic

func Panic(ctx context.Context, args ...any)

Panic logs panic message

func Panicf

func Panicf(ctx context.Context, format string, args ...any)

Panicf logs panic message with format

func SetOutput

func SetOutput(out io.Writer)

SetOutput sets the output destination for the logger

func SetVersion

func SetVersion(v string)

SetVersion sets the version for logging

func Trace

func Trace(ctx context.Context, args ...any)

Trace logs trace message

func Tracef

func Tracef(ctx context.Context, format string, args ...any)

Tracef logs trace message with format

func Warn

func Warn(ctx context.Context, args ...any)

Warn logs warn message

func Warnf

func Warnf(ctx context.Context, format string, args ...any)

Warnf logs warn message with format

func WithFields

func WithFields(ctx context.Context, fields logrus.Fields) *logrus.Entry

WithFields returns an entry with the given fields

Types

type ElasticSearchHook

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

ElasticSearchHook represents an Elasticsearch log hook

func (*ElasticSearchHook) Fire

func (h *ElasticSearchHook) Fire(entry *logrus.Entry) error

Fire sends log entry to Elasticsearch

func (*ElasticSearchHook) Levels

func (h *ElasticSearchHook) Levels() []logrus.Level

Levels returns all log levels

type Logger

type Logger struct {
	*logrus.Logger
	// contains filtered or unexported fields
}

Logger represents logger instance

func StdLogger

func StdLogger() *Logger

StdLogger returns the single logger instance

func (*Logger) AddHook

func (l *Logger) AddHook(hook logrus.Hook)

AddHook adds a hook to the logger

func (*Logger) Debug

func (l *Logger) Debug(ctx context.Context, args ...any)

Debug logs a debug message

func (*Logger) Debugf

func (l *Logger) Debugf(ctx context.Context, format string, args ...any)

Debugf logs a debug message with format

func (*Logger) Error

func (l *Logger) Error(ctx context.Context, args ...any)

Error logs an error message

func (*Logger) Errorf

func (l *Logger) Errorf(ctx context.Context, format string, args ...any)

Errorf logs an error message with format

func (*Logger) Fatal

func (l *Logger) Fatal(ctx context.Context, args ...any)

Fatal logs a fatal message

func (*Logger) Fatalf

func (l *Logger) Fatalf(ctx context.Context, format string, args ...any)

Fatalf logs a fatal message with format

func (*Logger) Info

func (l *Logger) Info(ctx context.Context, args ...any)

Info logs an info message

func (*Logger) Infof

func (l *Logger) Infof(ctx context.Context, format string, args ...any)

Infof logs an info message with format

func (*Logger) Init

func (l *Logger) Init(c *config.Logger) (func(), error)

Init initializes the logger with the given configuration

func (*Logger) Panic

func (l *Logger) Panic(ctx context.Context, args ...any)

Panic logs a panic message

func (*Logger) Panicf

func (l *Logger) Panicf(ctx context.Context, format string, args ...any)

Panicf logs a panic message with format

func (*Logger) SetOutput

func (l *Logger) SetOutput(out io.Writer)

SetOutput sets the output destination for the logger

func (*Logger) SetVersion

func (l *Logger) SetVersion(v string)

SetVersion sets the version for logging

func (*Logger) Trace

func (l *Logger) Trace(ctx context.Context, args ...any)

Trace logs a trace message

func (*Logger) Tracef

func (l *Logger) Tracef(ctx context.Context, format string, args ...any)

Tracef logs a trace message with format

func (*Logger) Warn

func (l *Logger) Warn(ctx context.Context, args ...any)

Warn logs a warn message

func (*Logger) Warnf

func (l *Logger) Warnf(ctx context.Context, format string, args ...any)

Warnf logs a warn message with format

type MeiliSearchHook

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

MeiliSearchHook represents a MeiliSearch log hook

func (*MeiliSearchHook) Fire

func (h *MeiliSearchHook) Fire(entry *logrus.Entry) error

Fire sends log entry to MeiliSearch

func (*MeiliSearchHook) Levels

func (h *MeiliSearchHook) Levels() []logrus.Level

Levels returns all log levels

Jump to

Keyboard shortcuts

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