logger

package
v1.72.26 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoLevel    = zerolog.NoLevel
	TraceLevel = zerolog.TraceLevel
	DebugLevel = zerolog.DebugLevel
	InfoLevel  = zerolog.InfoLevel
	WarnLevel  = zerolog.WarnLevel
	ErrorLevel = zerolog.ErrorLevel
	PanicLevel = zerolog.PanicLevel
	FatalLevel = zerolog.FatalLevel
)
View Source
const (
	LevelNo    = ""
	LevelTrace = "TRACE"
	LevelDebug = "DEBUG"
	LevelInfo  = "INFO"
	LevelWarn  = "WARN"
	LevelError = "ERROR"
	LevelPanic = "PANIC"
	LevelFatal = "FATAL"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Level string `desc:"TRACE, DEBUG, INFO, WARN, ERROR, PANIC, FATAL"`

	Stdout   bool `desc:"enable output to stdout"`
	Filename string

	MaxSizeMB  int  `desc:"max size of active log file in MB"`
	MaxAgeDays int  `desc:"max age days of backups files"`
	MaxBackups int  `desc:"max backups count"`
	Compress   bool `desc:"compress backups files"`
	// contains filtered or unexported fields
}

Config for zerolog logger

func (*Config) Repair added in v1.72.14

func (c *Config) Repair()

Repair errors

type Event added in v1.72.15

type Event = zerolog.Event

Event represents a log event. It is instanced by one of the level method of Logger and finalized by the Msg or Msgf method.

type Hook added in v1.72.19

type Hook func(b []byte)

func (Hook) Write added in v1.72.19

func (h Hook) Write(b []byte) (n int, err error)

type Level added in v1.72.15

type Level = zerolog.Level

Level defines log levels.

type Logger added in v1.72.15

type Logger = zerolog.Logger

A Logger represents an active logging object that generates lines of JSON output to an io.Writer. Each logging operation makes a single call to the Writer's Write method. There is no guarantee on access serialization to the Writer. If your Writer is not thread safe, you may consider a sync wrapper.

func New

func New(conf Config, hook Hook) Logger

New logger with config

func Nop added in v1.72.15

func Nop() Logger

Nop returns a disabled logger for which all operation are no-op.

Jump to

Keyboard shortcuts

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