ilogrus

package module
v0.0.0-...-1ac0e9d Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 5 Imported by: 0

README

ilogrus

Package ilogrus implements support for using github.com/sirupsen/logrus with github.com/joeycumines/logiface.

Documentation

Overview

Package ilogrus implements support for using github.com/sirupsen/logrus with github.com/joeycumines/logiface.

Index

Constants

This section is empty.

Variables

View Source
var (
	// L is a LoggerFactory, and may be used to configure a
	// logiface.Logger[*Event], using the implementations provided by this
	// package.
	L = LoggerFactory{}
)

Functions

func WithLogrus

func WithLogrus(logger *logrus.Logger) logiface.Option[*Event]

WithLogrus configures a logiface logger to use a logrus logger. Will panic if the logger is nil.

See also LoggerFactory.WithLogrus and L (an alias for LoggerFactory{}).

Types

type Event

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

func (*Event) AddError

func (x *Event) AddError(err error) bool

func (*Event) AddField

func (x *Event) AddField(key string, val any)

func (*Event) AddMessage

func (x *Event) AddMessage(msg string) bool

func (*Event) AddRawJSON

func (x *Event) AddRawJSON(key string, val json.RawMessage) bool

func (*Event) Level

func (x *Event) Level() logiface.Level

type Logger

type Logger struct {
	Logrus *logrus.Logger
}

func (*Logger) NewEvent

func (x *Logger) NewEvent(level logiface.Level) *Event

func (*Logger) ReleaseEvent

func (x *Logger) ReleaseEvent(event *Event)

func (*Logger) Write

func (x *Logger) Write(event *Event) error

type LoggerFactory

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

LoggerFactory is provided as a convenience, embedding logiface.LoggerFactory[*Event], and aliasing the option functions implemented within this package.

func (LoggerFactory) WithLogrus

func (LoggerFactory) WithLogrus(logger *logrus.Logger) logiface.Option[*Event]

WithLogrus is an alias of the package function of the same name.

Jump to

Keyboard shortcuts

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