fxlog

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2018 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

View Source
const (
	JsonFormat format = iota
	LogfmtFormat
)

Format constants

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(config *Config) (log.Logger, error)

NewLogger returns a new Logger.

func NewWriterAdapter added in v0.6.3

func NewWriterAdapter(logger log.Logger, options ...WriterAdapterOption) io.Writer

NewWriterAdapter returns a new WriterAdapter wrapper around the passed logger.

func ParseFormat

func ParseFormat(formatName string) (format, error)

ParseFormat parses a string format name and returns the format or an error if the format is invalid.

Types

type Config

type Config struct {
	Output        io.Writer
	Format        format
	FallbackLevel level.Value
	Context       []interface{}
	Debug         bool
}

Config holds a list of options used during the logger construction.

func NewConfig

func NewConfig() *Config

NewConfig returns a new config populated with default values.

type WriterAdapter added in v0.6.3

type WriterAdapter struct {
	log.Logger
	// contains filtered or unexported fields
}

WriterAdapter implements similar logic to StdlibAdapter in go-kit/log package, but instead of parsing incoming entries as standard go log entries WriterAdapter simply writes the whole entry as a log message.

func (WriterAdapter) Write added in v0.6.3

func (a WriterAdapter) Write(p []byte) (int, error)

type WriterAdapterOption added in v0.6.3

type WriterAdapterOption func(*WriterAdapter)

WriterAdapterOption sets a parameter for the WriterAdapter.

func MessageKey added in v0.6.3

func MessageKey(key string) WriterAdapterOption

MessageKey sets the key for the actual log message. By default, it's "msg".

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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