logger

package module
v0.0.0-...-6bdddb8 Latest Latest
Warning

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

Go to latest
Published: May 11, 2015 License: MIT Imports: 3 Imported by: 10

README

Logger

A simple stdout logger with levels.

Usage example

log := *logger.NewLogger(logger.LOG_LEVEL_INFO, "myapp")

log.Debug "too much information"      // no output
log.Info "things are going well"      // [info]  (myapp) things are going well
log.Warn "it's getting hot in here"   // [warn]  (myapp) it's getting hot in here
log.Error "it got too hot in here"    // [error] (myapp) it got too hot in here
log.Fatal "the system has melted"     // [fatal] (myapp) the system has melted

License

MIT license, see LICENSE for more information.

Documentation

Index

Constants

View Source
const (
	LOG_LEVEL_OFF = iota
	LOG_LEVEL_FATAL
	LOG_LEVEL_ERROR
	LOG_LEVEL_WARN
	LOG_LEVEL_INFO
	LOG_LEVEL_DEBUG
	LOG_LEVEL_TRACE
	LOG_LEVEL_ALL
)

Variables

View Source
var DefaultLevel int = LOG_LEVEL_INFO

Functions

This section is empty.

Types

type Logger

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

func NewDefaultLogger

func NewDefaultLogger(prefix string) *Logger

func NewLogger

func NewLogger(level int, prefix string) *Logger

func (*Logger) Debug

func (l *Logger) Debug(format string, v ...interface{})

func (*Logger) Error

func (l *Logger) Error(format string, v ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(format string, v ...interface{})

func (*Logger) Info

func (l *Logger) Info(format string, v ...interface{})

func (*Logger) Log

func (l *Logger) Log(level string, format string, v ...interface{})

func (*Logger) SetLevel

func (l *Logger) SetLevel(level int)

func (*Logger) Trace

func (l *Logger) Trace(format string, v ...interface{})

func (*Logger) Warn

func (l *Logger) Warn(format string, v ...interface{})

Jump to

Keyboard shortcuts

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