logger

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NilLogLogger = log.New(io.Discard, "", 0)
	NilLogger    nilLogger
)
View Source
var (
	NilRotator = &NopRotator{Writer: io.Discard}
)

Functions

func RotateShared added in v0.3.2

func RotateShared() error

RotateShared calls Rotate each shared rotators.

Types

type Logger added in v0.0.2

type Logger interface {
	fasthttp.Logger
	Rotator
	io.Closer
	LogLogger() *log.Logger
}

Logger is the interface that defines the methods to logging.

func NewLogger

func NewLogger(cfg config.Log) (Logger, error)

NewLogger creates a new logger.

func NewLoggerWriter added in v0.0.2

func NewLoggerWriter(cfg config.Log, out io.Writer) (Logger, error)

NewLoggerWriter returns a new logger with out.

type LoggerDelegator added in v0.3.3

type LoggerDelegator struct {
	PrintfFunc    func(format string, args ...interface{})
	RotateFunc    func() error
	WriteFunc     func([]byte) (int, error)
	CloseFunc     func() error
	LogLoggerFunc func() *log.Logger
}

LoggerDelegator can delegate the Logger functions.

func (*LoggerDelegator) Close added in v0.3.3

func (l *LoggerDelegator) Close() error

func (*LoggerDelegator) LogLogger added in v0.3.3

func (l *LoggerDelegator) LogLogger() *log.Logger

func (*LoggerDelegator) Printf added in v0.3.3

func (l *LoggerDelegator) Printf(format string, args ...interface{})

func (*LoggerDelegator) Rotate added in v0.3.3

func (l *LoggerDelegator) Rotate() error

func (*LoggerDelegator) Write added in v0.3.3

func (l *LoggerDelegator) Write(p []byte) (int, error)

type NopRotator added in v0.3.4

type NopRotator struct {
	io.Writer
}

NopRotator is a Writer with no-op Rotate and Close methods.

func (*NopRotator) Close added in v0.3.4

func (*NopRotator) Close() error

Close does nothing, returns nil.

func (*NopRotator) Rotate added in v0.3.4

func (*NopRotator) Rotate() error

Rotate does nothing, returns nil.

type Rotator added in v0.3.4

type Rotator interface {
	io.WriteCloser
	Rotate() error
}

Rotator is the interface that groups the Rotate and basic Write, Close methods.

func NewRotator added in v0.3.4

func NewRotator(output string, cfg config.Rotation) (Rotator, error)

NewRotator creates a new rotator.

func SharedRotator added in v0.3.4

func SharedRotator(output string, cfg config.Rotation) (Rotator, error)

SharedRotator returns a Rotator that is mapped by output. If the Rotator mapped by output does not exist, a new Rotator is created. If there are duplicate ouput, the backward cfg is ignored.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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