Documentation
¶
Index ¶
- Variables
- func GetCtxLogger(ctx context.Context) logrus.FieldLogger
- func NewSlogLogger(outputFile, application string) *slog.Logger
- func NewStructuredLoggerEntry(logger logrus.FieldLogger, ctx context.Context) context.Context
- func SetLoggerFields(ctx context.Context, fields logrus.Fields) (context.Context, logrus.FieldLogger)
- func SetupLoggers()
- func WriteErrorWithFields(ctx context.Context, msg string, fields logrus.Fields) (context.Context, logrus.FieldLogger)
- func WriteInfoWithFields(ctx context.Context, msg string, fields logrus.Fields) (context.Context, logrus.FieldLogger)
- func WriteWarnWithFields(ctx context.Context, msg string, fields logrus.Fields) (context.Context, logrus.FieldLogger)
- type CtxLoggerKeyType
- type StructuredLoggerEntry
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 ¶
River requires a slog.Logger for logging, this function converts logrus to slog
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 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
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)
Click to show internal directories.
Click to hide internal directories.