log

package
v0.0.0-...-c18a219 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 18 Imported by: 18

Documentation

Index

Constants

View Source
const (
	LevelDebug = Level(0)
	LevelInfo  = Level(1)
	LevelWarn  = Level(2)
	LevelError = Level(3)
	LevelPanic = Level(4)
	LevelFatal = Level(5)
	LevelOff   = Level(6)
)

Variables

This section is empty.

Functions

func Configure

func Configure(opts Options) error

func RegisterWriter

func RegisterWriter(name string, b WriterBuilder)

func SetDefaultLevel

func SetDefaultLevel(lvl Level)

func SetManager

func SetManager(m Manager)

Types

type Entry

type Entry interface {
	WithField(key string, value interface{}) Entry
	WithFields(fields map[string]interface{}) Entry
	Debug(args ...interface{})
	Debugf(format string, args ...interface{})
	Info(args ...interface{})
	Infof(format string, args ...interface{})
	Warn(args ...interface{})
	Warnf(format string, args ...interface{})
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Panic(args ...interface{})
	Panicf(format string, args ...interface{})
	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
}

type JSONLayout

type JSONLayout struct {
	// contains filtered or unexported fields
}

func (JSONLayout) Parse

func (l JSONLayout) Parse(s string) ([]Segment, error)

type Layout

type Layout interface {
	Parse(s string) ([]Segment, error)
}

type Level

type Level int8

type Logger

type Logger interface {
	io.Writer
	Name() string
	Level() Level
	SetLevel(lvl Level)
	IsEnabled(lvl Level) bool
	WithField(key string, value interface{}) Entry
	WithFields(fields map[string]interface{}) Entry
	Debug(args ...interface{})
	Debugf(format string, args ...interface{})
	Info(args ...interface{})
	Infof(format string, args ...interface{})
	Warn(args ...interface{})
	Warnf(format string, args ...interface{})
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Panic(args ...interface{})
	Panicf(format string, args ...interface{})
	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
}

func Find

func Find(name string) Logger

func Get

func Get(name string) Logger

type LoggerOptions

type LoggerOptions struct {
	Name    string
	Level   string
	Writers []string
}

type Manager

type Manager interface {
	Get(name string) Logger
	Find(name string) Logger
	Configure(opts Options) error
}

type Options

type Options struct {
	Loggers []LoggerOptions
	Writers []WriterOptions
}

type Segment

type Segment struct {
	Type string
	Name string
	Args []string
}

type TextLayout

type TextLayout struct {
	// contains filtered or unexported fields
}

func (TextLayout) Parse

func (l TextLayout) Parse(s string) ([]Segment, error)

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func (*Writer) Name

func (w *Writer) Name() string

func (*Writer) Output

func (w *Writer) Output() io.Writer

func (*Writer) Write

func (w *Writer) Write(e *entry) (err error)

type WriterBuilder

type WriterBuilder func(options data.Map) (io.Writer, error)

type WriterBuilders

type WriterBuilders map[string]WriterBuilder

func (WriterBuilders) Build

func (bs WriterBuilders) Build(name string, options data.Map) (io.Writer, error)

type WriterOptions

type WriterOptions struct {
	Name string
	// console/file/[omit]
	Type   string
	Layout string
	// text/json, default: text
	Format  string
	Options data.Map
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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