log

package
v0.0.0-...-c187892 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2016 License: MIT, GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version = "0.1.1" // atomic running
)

Variables

This section is empty.

Functions

func Flush

func Flush()

Flush the log channels. Concurrent users of the logger should quit before Flush() is called to ensure it completes.

func SetLogLevel

func SetLogLevel(pkg string, level LogLevel)

set levels for individual packages

func SetLogLevelGlobal

func SetLogLevelGlobal(level LogLevel)

func SetLoggers

func SetLoggers(level LogLevel, w io.Writer, ew io.Writer)

set level and writer for all loggers

Types

type ErisFormatter

type ErisFormatter struct{}

func (ErisFormatter) Format

func (f ErisFormatter) Format(entry *log.Entry) (out []byte, err error)

Format implements the logrus.Formatter interface. It returns a formatted log line as a slice of bytes.

type LogLevel

type LogLevel uint8
const (
	LogLevelError LogLevel = iota
	LogLevelWarn
	LogLevelInfo
	LogLevelDebug
)

type Logger

type Logger struct {
	Level LogLevel
	Pkg   string

	// these are here for easy access
	// for functions that want the writer
	Writer    *SafeWriter
	ErrWriter *SafeWriter
}

func AddLogger

func AddLogger(pkg string) *Logger

add a default logger with pkg name

func (*Logger) Debugf

func (l *Logger) Debugf(s string, args ...interface{})

Debugf and Debugln write to the Writer if log level >= 3

func (*Logger) Debugln

func (l *Logger) Debugln(s ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(s string, args ...interface{})

Errorf and Errorln write to the ErrWriter no matter what

func (*Logger) Errorln

func (l *Logger) Errorln(s ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(s string, args ...interface{})

Infof and Infoln write to the Writer if log level >= 2

func (*Logger) Infoln

func (l *Logger) Infoln(s ...interface{})

func (*Logger) Printf

func (l *Logger) Printf(s string, args ...interface{})

Printf and Println write to the Writer no matter what

func (*Logger) Println

func (l *Logger) Println(s ...interface{})

func (*Logger) Warnf

func (l *Logger) Warnf(s string, args ...interface{})

Warnf and Warnln write to the Writer if log level >= 1

func (*Logger) Warnln

func (l *Logger) Warnln(s ...interface{})

type SafeWriter

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

func NewSafeWriter

func NewSafeWriter(ch chan []byte) *SafeWriter

func (*SafeWriter) Write

func (sw *SafeWriter) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

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