types

package
v0.0.0-...-e8f9f86 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2020 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DEBUG     = 100
	INFO      = 200
	NOTICE    = 250
	WARNING   = 300
	ERROR     = 400
	CRITICAL  = 500
	ALERT     = 550
	EMERGENCY = 600
)

log levels

Variables

This section is empty.

Functions

func ReleaseRecord

func ReleaseRecord(record *Record)

ReleaseRecord Put record to pool.

Types

type FormattableHandler

type FormattableHandler interface {
	// Sets the formatter.
	SetFormatter(formatter *Formatter) *IHandler

	// Gets the formatter.
	GetFormatter() *Formatter
}

FormattableHandler Interface to describe loggers that have a formatter

type Formatter

type Formatter interface {
	// Format formats a log record.
	Format(record *Record) error

	// FormatBatch formats a set of log records.
	FormatBatch(records []*Record) error
}

Formatter interface fromatter

type IHandler

type IHandler interface {
	// Checks whether the given record will be handled by this handler.
	IsHandling(record *Record) bool

	// Handles a record.
	Handle(record *Record) bool

	// Handles a set of records at once.
	HandleBatch(records []*Record)

	// Closes the handler.
	Close()
}

IHandler Interface of the Handler.

type ProcessableHandler

type ProcessableHandler interface {
	// Adds a processor in the stack.
	PushProcessor() *IHandler

	// Removes the processor on top of the stack and returns it.
	PopProcessor()
}

ProcessableHandler Interface to describe loggers that have processors

type Processor

type Processor func(record *Record, a ...interface{})

Processor func

type Record

type Record struct {
	Level     int
	LevelName string
	Channel   string
	Datetime  time.Time
	Message   string
	Context   RecordContext
	Extra     RecordExtra
	Formatted *bytes.Buffer
}

Record struct definition

func GetRecord

func GetRecord() *Record

GetRecord Get record

func NewRecord

func NewRecord() *Record

NewRecord Get record from pool.

type RecordContext

type RecordContext map[string]interface{}

RecordContext record context map

type RecordExtra

type RecordExtra map[string]interface{}

RecordExtra record extra map

Jump to

Keyboard shortcuts

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