esl

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 16 Imported by: 3

Documentation

Index

Constants

View Source
const (
	FlavorConsole      = iota
	FlavorFileStandard // for debug log
	FlavorFileCapture  // for capture log
)
View Source
const (
	LevelDebug = iota
	LevelInfo
	LevelWarn
	LevelError
	LevelQuiet
)

Variables

View Source
var (
	ErrorCallerTestMessageNotFound = errors.New("test message not found in the output")
	ErrorCallerTestLineIsNotJSON   = errors.New("line is not json format")
)

Functions

func AddDefaultSubscriber

func AddDefaultSubscriber(l Logger)

func EnsureCallerSkip

func EnsureCallerSkip(l Logger, msgKey, callerKey string, fetchOut func() string) error

Test caller skip

Types

type Field

type Field interface {
	// contains filtered or unexported methods
}

func Any

func Any(key string, val interface{}) Field

func Binary

func Binary(key string, val []byte) Field

func Bool

func Bool(key string, val bool) Field

func ByteString

func ByteString(key string, val []byte) Field

func Duration

func Duration(key string, val time.Duration) Field

func Error

func Error(err error) Field

func Errors

func Errors(key string, val []error) Field

func Float32

func Float32(key string, val float32) Field

func Float64

func Float64(key string, val float64) Field

func Int

func Int(key string, val int) Field

func Int16

func Int16(key string, val int16) Field

func Int32

func Int32(key string, val int32) Field

func Int64

func Int64(key string, val int64) Field

func Int8

func Int8(key string, val int8) Field

func String

func String(key string, val string) Field

func Strings

func Strings(key string, val []string) Field

func Time

func Time(key string, val time.Time) Field

func Uint

func Uint(key string, val uint) Field

func Uint16

func Uint16(key string, val uint16) Field

func Uint32

func Uint32(key string, val uint32) Field

func Uint64

func Uint64(key string, val uint64) Field

func Uint8

func Uint8(key string, val uint8) Field

type Flavor

type Flavor int

type Level

type Level int

func ConsoleDefaultLevel

func ConsoleDefaultLevel() Level

type LogCloser

type LogCloser interface {
	Logger
	io.Closer
}

func NewLogCloser

func NewLogCloser(level Level, flavor Flavor, w io.WriteCloser) LogCloser

type Logger

type Logger interface {
	With(fields ...Field) Logger
	AddCallerSkip(n int) Logger

	Debug(msg string, fields ...Field)
	Info(msg string, fields ...Field)
	Warn(msg string, fields ...Field)
	Error(msg string, fields ...Field)

	Sync() error
}

func Capture

func Capture() Logger

func ConsoleOnly

func ConsoleOnly() Logger

func Default

func Default() Logger

func New

func New(level Level, flavor Flavor, w io.Writer) Logger

type RootLogger

type RootLogger interface {
	// Set log level for the console.
	SetLevelConsole(level Level)

	// Add logger to root log audience.
	AddSubscriber(l Logger)

	// Remove logger from root log audience.
	RemoveSubscriber(l Logger)

	// Get current logger.
	Current() Logger
}

type Tee

type Tee interface {
	Logger

	// Add subscriber. And returns self instance.
	AddSubscriber(l Logger) Tee

	// Remove subscriber.
	RemoveSubscriber(l Logger) Tee
}

Tee implementation is mutable.

func NewTee

func NewTee() Tee

Jump to

Keyboard shortcuts

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