iface

package
v1.0.100 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

View Source
const LevelCount = 6

LevelCount is the total count of available levels except for Off.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auxiliary

type Auxiliary struct {
	Prefix   string
	Contexts []Context
	Marked   bool
}

An Auxiliary is a set of extra attributes that are associated with a log.

type Context

type Context struct {
	Key   string
	Value string
}

A Context is a pair of key-value that is associated with a log.

type Formatter

type Formatter interface {
	Format(record *Record) []byte
}

Formatter is the interface that a formatter of a Logger needs to implement. A Formatter must NOT modify the record. In case of asynchrony, a Formatter needs to make and return a new byte slice each time.

Do NOT call any method of the Logger within Format, or it may deadlock.

type Level

type Level int

The Level defines the level type.

const (
	Trace Level = iota + 1
	Debug
	Info
	Warn
	Error
	Fatal
	Off
)

All available levels here.

type Record

type Record struct {
	Time  time.Time
	Level Level
	File  string
	Line  int
	Pkg   string
	Func  string
	Msg   string
	Aux   Auxiliary
}

A Record contains all information of a log.

type Writer

type Writer interface {
	Write(bs []byte, record *Record)
}

Writer is the interface that a writer of a Logger needs to implement. A Writer must NOT modify the bs and record.

Do NOT call any method of the Logger within Write, or it may deadlock.

Jump to

Keyboard shortcuts

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