logging

package
v0.0.0-...-ea36977 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2015 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package logging provides basic logging features (modules, log levels).

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogLevel = INFO

DefaultLogLevel is set to INFO.

Functions

This section is empty.

Types

type Level

type Level int

Level defines the log level. Can be one of the following: * OFF * FATAL * ERROR * WARN * INFO * DEBUG * TRACE

const (
	// OFF disables logging
	OFF Level = iota
	// FATAL logs fatals
	FATAL
	// ERROR logs at least errors
	ERROR
	// WARN logs at least warnings
	WARN
	// INFO logs at least infos
	INFO
	// DEBUG logs at least debug output
	DEBUG
	// TRACE logs everything (verbose!)
	TRACE
)

func (Level) String

func (ll Level) String() string

type Logger

type Logger struct {
	*log.Logger
	Level  Level
	Module string
}

Logger is used to extend log.Logger.

func GetLogger

func GetLogger(module string) *Logger

GetLogger creates a new logger object with the given prefix.

func (*Logger) Debug

func (l *Logger) Debug(message string)

Debug logs debug level messages.

func (*Logger) Debugf

func (l *Logger) Debugf(message string, a ...interface{})

Debugf logs formatted debug level messages.

func (*Logger) Error

func (l *Logger) Error(message string)

Error logs error level messages.

func (*Logger) Errorf

func (l *Logger) Errorf(message string, a ...interface{})

Errorf logs formatted error level messages.

func (*Logger) Fatal

func (l *Logger) Fatal(message string)

Fatal logs fatal level messages.

func (*Logger) Fatalf

func (l *Logger) Fatalf(message string, a ...interface{})

Fatalf logs formatted fatal level messages.

func (*Logger) Info

func (l *Logger) Info(message string)

Info logs info level messages.

func (*Logger) Infof

func (l *Logger) Infof(message string, a ...interface{})

Infof logs formatted info level messages.

func (*Logger) SetLevel

func (l *Logger) SetLevel(level Level)

SetLevel sets the current log leve. Messages with a lower level than the given level will be omitted.

func (*Logger) Trace

func (l *Logger) Trace(message string)

Trace logs trace level messages.

func (*Logger) Tracef

func (l *Logger) Tracef(message string, a ...interface{})

Tracef logs formatted trace level messages.

func (*Logger) Warn

func (l *Logger) Warn(message string)

Warn logs warn level messages.

func (*Logger) Warnf

func (l *Logger) Warnf(message string, a ...interface{})

Warnf logs formatted warn level messages.

Jump to

Keyboard shortcuts

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