log

package
v0.0.0-...-7444e04 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: CC0-1.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	API     logrus.FieldLogger = defaultFieldLogger("api")
	Auth    logrus.FieldLogger = defaultFieldLogger("auth")
	BFDAPI  logrus.FieldLogger = defaultFieldLogger("bfd")
	Request logrus.FieldLogger = defaultFieldLogger("request")
	SSAS    logrus.FieldLogger = defaultFieldLogger("ssas")

	Worker    logrus.FieldLogger = defaultFieldLogger("worker")
	BFDWorker logrus.FieldLogger = defaultFieldLogger("bfd")
	Health    logrus.FieldLogger = defaultFieldLogger("health")
)

Functions

func GetCtxLogger

func GetCtxLogger(ctx context.Context) logrus.FieldLogger

Gets the logrus.FieldLogger from a context

func NewSlogLogger

func NewSlogLogger(outputFile, application string) *slog.Logger

River requires a slog.Logger for logging, this function converts logrus to slog

func NewStructuredLoggerEntry

func NewStructuredLoggerEntry(logger logrus.FieldLogger, ctx context.Context) context.Context

func SetLoggerFields

func SetLoggerFields(ctx context.Context, fields logrus.Fields) (context.Context, logrus.FieldLogger)

Appends additional fields to our logger and sets it back into context

func SetupLoggers

func SetupLoggers()

setup global access to loggers, overwrite default logger

func WriteErrorWithFields

func WriteErrorWithFields(ctx context.Context, msg string, fields logrus.Fields) (context.Context, logrus.FieldLogger)

Sets fields into logger, writes error entry, and sets logger back into context

func WriteInfoWithFields

func WriteInfoWithFields(ctx context.Context, msg string, fields logrus.Fields) (context.Context, logrus.FieldLogger)

Sets fields into logger, writes info entry, and sets logger back into context

func WriteWarnWithFields

func WriteWarnWithFields(ctx context.Context, msg string, fields logrus.Fields) (context.Context, logrus.FieldLogger)

Sets fields into logger, writes warning entry, and sets logger back into context

Types

type CtxLoggerKeyType

type CtxLoggerKeyType string

type to create context.Context key

const CtxLoggerKey CtxLoggerKeyType = "ctxLogger"

context.Context key to set/get logrus.FieldLogger value within request context

type StructuredLoggerEntry

type StructuredLoggerEntry struct {
	Logger logrus.FieldLogger
}

func (*StructuredLoggerEntry) Panic

func (l *StructuredLoggerEntry) Panic(v interface{}, stack []byte)

func (*StructuredLoggerEntry) Write

func (l *StructuredLoggerEntry) Write(status int, bytes int, header http.Header, elapsed time.Duration, extra interface{})

Jump to

Keyboard shortcuts

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