logger

package
v0.0.0-...-b918686 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2016 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultFlags are passed to the default console log.Logger
	DefaultFlags = log.Ldate | log.Ltime | log.Lmicroseconds | log.Lshortfile
	// SyslogFlags are passed to the default syslog log.Logger
	SyslogFlags = log.Lshortfile
	// SyslogPriority for the default syslog log.Logger
	SyslogPriority = syslog.LOG_DEBUG | syslog.LOG_USER
)

Variables

View Source
var NullLogger = nullLogger{}

NullLogger is a logger that does nothing

Functions

func Debugf

func Debugf(format string, v ...interface{})

Debugf records something in the debug log

func Noticef

func Noticef(format string, v ...interface{})

Noticef notifies the user of something

func Panicf

func Panicf(format string, v ...interface{})

Panicf notifies the user and then panics

func SetLogger

func SetLogger(l Logger)

SetLogger sets the global logger to the given one

func SimpleSetup

func SimpleSetup() error

SimpleSetup creates the default (console) logger

Types

type ConsoleLog

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

ConsoleLog sends Notices to a log.Logger and Debugs to syslog

func NewConsoleLog

func NewConsoleLog(w io.Writer, flag int) (*ConsoleLog, error)

NewConsoleLog creates a ConsoleLog with a log.Logger using the given io.Writer and flag, and a syslog.Writer.

func (*ConsoleLog) Debug

func (l *ConsoleLog) Debug(msg string)

Debug sends the msg to syslog

func (*ConsoleLog) Notice

func (l *ConsoleLog) Notice(msg string)

Notice alerts the user about something, as well as putting it syslog

type Logger

type Logger interface {
	// Notice is for messages that the user should see
	Notice(msg string)
	// Debug is for messages that the user should be able to find if they're debugging something
	Debug(msg string)
}

A Logger is a fairly minimal logging tool.

Jump to

Keyboard shortcuts

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