logger

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2015 License: MIT Imports: 6 Imported by: 52

README

logger

A small wrapper around log to provide log levels.

Documentation

http://godoc.org/github.com/calmh/logger

License

MIT

Documentation

Overview

Package logger implements a standardized logger with callback functionality

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogger = New()

The default logger logs to standard output with a time prefix.

Functions

This section is empty.

Types

type LogLevel

type LogLevel int
const (
	LevelDebug LogLevel = iota
	LevelVerbose
	LevelInfo
	LevelOK
	LevelWarn
	LevelFatal
	NumLevels
)

type Logger

type Logger interface {
	AddHandler(level LogLevel, h MessageHandler)
	SetFlags(flag int)
	SetPrefix(prefix string)
	Debugln(vals ...interface{})
	Debugf(format string, vals ...interface{})
	Verboseln(vals ...interface{})
	Verbosef(format string, vals ...interface{})
	Infoln(vals ...interface{})
	Infof(format string, vals ...interface{})
	Okln(vals ...interface{})
	Okf(format string, vals ...interface{})
	Warnln(vals ...interface{})
	Warnf(format string, vals ...interface{})
	Fatalln(vals ...interface{})
	Fatalf(format string, vals ...interface{})
	ShouldDebug(facility string) bool
	SetDebug(facility string, enabled bool)
	Facilities() (enabled, disabled []string)
	NewFacility(facility string) Logger
}

func New

func New() Logger

type MessageHandler

type MessageHandler func(l LogLevel, msg string)

A MessageHandler is called with the log level and message text.

Jump to

Keyboard shortcuts

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