log

package
v0.0.0-...-fbbe109 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2016 License: MIT Imports: 8 Imported by: 5

Documentation

Overview

Package log contains simple leveled logging implementation on top of stdlib logger. NOTE: without "only stdlib" constraint I would use github.com/uber-go/zap for logging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fields

type Fields map[string]interface{}

func (Fields) Fields

func (f Fields) Fields() map[string]interface{}

type Level

type Level int
const (
	DebugLevel Level = iota
	InfoLevel
	WarnLevel
	ErrorLevel
	FatalLevel
)

func LevelFromString

func LevelFromString(s string) (l Level, err error)

func (Level) String

func (l Level) String() string

type LogFields

type LogFields interface {
	Fields() map[string]interface{}
}

type Logger

type Logger interface {
	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{})
	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
	Panic(args ...interface{})
	Panicf(format string, args ...interface{})
	WithFields(keyValues LogFields) Logger
	Fields() Fields
}

Logger interface is subset of github.com/uber-common/bark.Logger methods.

func NewLogger

func NewLogger(l Level, w io.Writer) Logger

func NewLoggerSink

func NewLoggerSink(l Level, s Sink) Logger

type Sink

type Sink interface {
	Output(callDepth int, s string) error
}

Jump to

Keyboard shortcuts

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