fxlog

package
v1.13.2 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry added in v1.13.2

type Entry struct {
	Level   Level
	Message string
	Fields  []Field
	Stack   string
}

Entry is an entry to be later serialized into zap message and fields.

func Error added in v1.13.2

func Error(msg string, fields ...Field) Entry

Error creates a logging Error entry.

func Info added in v1.13.2

func Info(msg string, fields ...Field) Entry

Info creates a logging Info entry.

func (Entry) WithStack added in v1.13.2

func (e Entry) WithStack(stack string) Entry

WithStack mutates an Entry to add a Stack field.

func (Entry) Write added in v1.13.2

func (e Entry) Write(logger Logger)

type Field added in v1.13.2

type Field struct {
	Key   string
	Value interface{}
}

Field defines a field used inside an internal logging Entry.

func Err added in v1.13.2

func Err(value error) Field

Err is a helper for error Fields.

func F added in v1.13.2

func F(key string, value interface{}) Field

F is a constructor for a Field.

type Level added in v1.13.2

type Level int

Level is the level of logging used by Logger.

const (
	// InfoLevel is Info logging level used to log messages via zap.
	InfoLevel Level = iota
	// ErrorLevel is Info logging level used to log messages via zap.
	ErrorLevel
)

type Logger

type Logger interface {
	Log(entry Entry)
}

Logger defines interface used for logging.

func DefaultLogger added in v1.13.2

func DefaultLogger(ws zapcore.WriteSyncer) Logger

DefaultLogger constructs a Logger out of io.Writer.

type Spy added in v1.13.2

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

Spy is an Fx Printer that captures logged statements. It may be used in tests of Fx logs.

func (*Spy) Fields added in v1.13.2

func (s *Spy) Fields() []zap.Field

Fields returns all Fields members of entries.

func (*Spy) Log added in v1.13.2

func (s *Spy) Log(entry Entry)

Log append an Entry.

func (*Spy) Messages added in v1.13.2

func (s *Spy) Messages() []Entry

Messages returns a copy of all captured messages.

func (*Spy) Reset added in v1.13.2

func (s *Spy) Reset()

Reset clears all messages from the Spy.

func (*Spy) String added in v1.13.2

func (s *Spy) String() string

String returns all logged messages as a single newline-delimited string.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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