Documentation ¶
Overview ¶
Package log defines a generic log implemetation with differing granularity levels.
The logger is built on top of the standard golang log package.
Index ¶
- Constants
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func Init(l int) error
- func InitFromString(l string) error
- func Trace(v ...interface{})
- func Tracef(format string, v ...interface{})
- func Warn(v ...interface{})
- func Warnf(format string, v ...interface{})
- type DefaultLogger
- type Logger
Constants ¶
const ( LevelNone = 0 LevelError = 1 LevelInfo = 2 LevelWarn = 3 LevelDebug = 4 LevelTrace = 5 )
Level setting constants
LevelTrace > LevelDebug > LevelWarn > LevelInfo > LevelError > LevelNone
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(v ...interface{})
Debug provides debug level logging in the manner of fmt.Print
func Debugf ¶
func Debugf(format string, v ...interface{})
Debugf provides debug level logging in the manner of fmt.Printf
func Error ¶
func Error(v ...interface{})
Error provides error level logging in the manner of fmt.Print
func Errorf ¶
func Errorf(format string, v ...interface{})
Errorf provides error level logging in the manner of fmt.Printf
func Fatal ¶
func Fatal(v ...interface{})
Fatal provides fatal level logging in the manner of fmt.Print. Being fatal it will log, and then it will exit the current process.
func Fatalf ¶
func Fatalf(format string, v ...interface{})
Fatalf provides fatal level logging in the manner of fmt.Printf. Being fatal it will log, and then it will exit the current process.
func Infof ¶
func Infof(format string, v ...interface{})
Infof provides info level logging in the manner of fmt.Printf
func Init ¶
Init initialises the logger. This must be called at least once before and of the functions can be called.
func InitFromString ¶
InitFromString initialises the logger with Init(). Takes a string rather than a numerical levvel
func Trace ¶
func Trace(v ...interface{})
Trace provides trace level logging in the manner of fmt.Print
func Tracef ¶
func Tracef(format string, v ...interface{})
Tracef provides trace level logging in the manner of fmt.Printf
Types ¶
type DefaultLogger ¶
type DefaultLogger struct {
Level int
}
DefaultLogger defines a simple logging package
type Logger ¶
type Logger interface { Fatal(v ...interface{}) Trace(v ...interface{}) Debug(v ...interface{}) Info(fv ...interface{}) Warn(v ...interface{}) Error(v ...interface{}) Fatalf(format string, v ...interface{}) Tracef(format string, v ...interface{}) Debugf(format string, v ...interface{}) Infof(fformat string, v ...interface{}) Warnf(format string, v ...interface{}) Errorf(format string, v ...interface{}) }
Logger is the default interface all logs must implement in this library