lager

package
v0.0.0-...-b3654af Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2014 License: Apache-2.0 Imports: 7 Imported by: 0

README

lager

An opinionated logger for Go.

Documentation

Index

Constants

View Source
const STACK_TRACE_BUFFER_SIZE = 1024 * 100

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data map[string]interface{}

type LogFormat

type LogFormat struct {
	Timestamp string   `json:"timestamp"`
	Source    string   `json:"source"`
	Message   string   `json:"message"`
	LogLevel  LogLevel `json:"log_level"`
	Data      Data     `json:"data"`
}

func (LogFormat) ToJSON

func (log LogFormat) ToJSON() []byte

type LogLevel

type LogLevel int
const (
	DEBUG LogLevel = iota
	INFO
	ERROR
	FATAL
)

type Logger

type Logger interface {
	RegisterSink(Sink)
	Session(task string, data ...Data) Logger
	Debug(action string, data ...Data)
	Info(action string, data ...Data)
	Error(action string, err error, data ...Data)
	Fatal(action string, err error, data ...Data)
}

func NewLogger

func NewLogger(component string) Logger

type Sink

type Sink interface {
	//Log to the sink.  Best effort -- no need to worry about errors.
	Log(level LogLevel, payload []byte)
}

A Sink represents a write destination for a Logger. It provides a thread-safe interface for writing logs

func NewWriterSink

func NewWriterSink(writer io.Writer, minLogLevel LogLevel) Sink

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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