loglevel: github.com/llimllib/loglevel Index | Files | Directories

package loglevel

import "github.com/llimllib/loglevel"

Package loglevel aims to be the simplest and best-tested levelled logging wrapper around go's standard library log module. It retains as much of the same API as possible.

Index

Package Files

const.go log.go logger.go

Constants

const (
    Poff = iota
    Pfatal
    Perror
    Pwarn
    Pinfo
    Pdebug
    Ptrace
    Pall
)

Priority used for identifying the severity of an event.

const (
    Ldate         = 1 << iota     // the date: 2012/01/23
    Ltime                         // the time: 01:23:23
    Lmicroseconds                 // microsecond resolution: 01:23:23.123123.  assumes Ltime.
    Llongfile                     // full file name and line number: /a/b/c/d.go:23
    Lshortfile                    // final file name element and line number: d.go:23. overrides Llongfile
    Lpriority                     // the priority: Debug
    LstdFlags     = Ldate | Ltime // initial values for the standard logger
)

Flags used for identifying the format of an event. They are or'ed together to control what's printed. There is no control over the order they appear (the order listed here) or the format they present (as described in the comments). A colon appears after these items:

2009/01/23 01:23:23.123123 /a/b/c/d.go:23: message

func Debug Uses

func Debug(v ...interface{})

Debug prints to the standard logger with the Debug level.

func Debugf Uses

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

Debugf prints to the standard logger with the Debug level.

func Debugln Uses

func Debugln(v ...interface{})

Debugln prints to the standard logger with the Debug level.

func Error Uses

func Error(v ...interface{})

Error prints to the standard logger with the Error level.

func Errorf Uses

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

Errorf prints to the standard logger with the Error level.

func Errorln Uses

func Errorln(v ...interface{})

Errorln prints to the standard logger with the Error level.

func Fatal Uses

func Fatal(v ...interface{})

Fatal prints the message it's given and quits the program

func Fatalf Uses

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

Fatalf prints the message it's given and quits the program

func Fatalln Uses

func Fatalln(v ...interface{})

Fatalln prints the message it's given and quits the program

func Flags Uses

func Flags() int

Flags returns the output layouts for the standard logger.

func Info Uses

func Info(v ...interface{})

Info prints to the standard logger with the Info level.

func Infof Uses

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

Infof prints to the standard logger with the Info level.

func Infoln Uses

func Infoln(v ...interface{})

Infoln prints to the standard logger with the Info level.

func Panic Uses

func Panic(v ...interface{})

Panic prints the message it's given and panic()s the program

func Panicf Uses

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

Panicf prints the message it's given and panic()s the program

func Panicln Uses

func Panicln(v ...interface{})

Panicln prints the message it's given and panic()s the program

func Priority Uses

func Priority() int

Priority returns the output priority for the standard logger.

func SetFlags Uses

func SetFlags(flags int)

SetFlags sets the output layouts for the standard logger.

func SetOutput Uses

func SetOutput(out io.Writer)

SetOutput sets the output destination for the standard logger

func SetPrefix Uses

func SetPrefix(prefix string)

SetPrefix sets the logger prefix

func SetPriority Uses

func SetPriority(priority int)

SetPriority sets the output priority for the standard logger.

func SetPriorityString Uses

func SetPriorityString(s string) error

SetPriorityString sets the output priority by the name of a debug level

func Trace Uses

func Trace(v ...interface{})

Trace prints to the standard logger with the Trace level.

func Tracef Uses

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

Tracef prints to the standard logger with the Trace level.

func Traceln Uses

func Traceln(v ...interface{})

Traceln prints to the standard logger with the Trace level.

func Warn Uses

func Warn(v ...interface{})

Warn prints to the standard logger with the Warn level.

func Warnf Uses

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

Warnf prints to the standard logger with the Warn level.

func Warnln Uses

func Warnln(v ...interface{})

Warnln prints to the standard logger with the Warn level.

type Logger Uses

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

Logger defines our wrapper around the system logger

func New Uses

func New(out io.Writer, prefix string, flag int, priority int) *Logger

New creates a new Logger.

func (*Logger) Debug Uses

func (me *Logger) Debug(v ...interface{})

Debug prints to the standard logger with the Debug level.

func (*Logger) Debugf Uses

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

Debugf prints to the standard logger with the Debug level.

func (*Logger) Debugln Uses

func (me *Logger) Debugln(v ...interface{})

Debugln prints to the standard logger with the Debug level.

func (*Logger) Error Uses

func (me *Logger) Error(v ...interface{})

Error prints to the standard logger with the Error level.

func (*Logger) Errorf Uses

func (me *Logger) Errorf(format string, v ...interface{})

Errorf prints to the standard logger with the Error level.

func (*Logger) Errorln Uses

func (me *Logger) Errorln(v ...interface{})

Errorln prints to the standard logger with the Error level.

func (*Logger) Fatal Uses

func (me *Logger) Fatal(v ...interface{})

Fatal prints the message it's given and quits the program

func (*Logger) Fatalf Uses

func (me *Logger) Fatalf(format string, v ...interface{})

Fatalf prints the message it's given and quits the program

func (*Logger) Fatalln Uses

func (me *Logger) Fatalln(v ...interface{})

Fatalln prints the message it's given and quits the program

func (*Logger) Flags Uses

func (me *Logger) Flags() int

Flags returns the output layouts for the logger.

func (*Logger) Info Uses

func (me *Logger) Info(v ...interface{})

Info prints to the standard logger with the Info level.

func (*Logger) Infof Uses

func (me *Logger) Infof(format string, v ...interface{})

Infof prints to the standard logger with the Info level.

func (*Logger) Infoln Uses

func (me *Logger) Infoln(v ...interface{})

Infoln prints to the standard logger with the Info level.

func (*Logger) Panic Uses

func (me *Logger) Panic(v ...interface{})

Panic prints the message it's given and panic()s the program

func (*Logger) Panicf Uses

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

Panicf prints the message it's given and panic()s the program

func (*Logger) Panicln Uses

func (me *Logger) Panicln(v ...interface{})

Panicln prints the message it's given and panic()s the program

func (*Logger) Prefix Uses

func (me *Logger) Prefix() string

Prefix returns the current logger prefix

func (*Logger) Priority Uses

func (me *Logger) Priority() int

Priority returns the output priority for the logger.

func (*Logger) SetFlags Uses

func (me *Logger) SetFlags(layouts int)

SetFlags sets the output layouts for the logger.

func (*Logger) SetPrefix Uses

func (me *Logger) SetPrefix(prefix string)

SetPrefix sets the output prefix for the logger.

func (*Logger) SetPriority Uses

func (me *Logger) SetPriority(priority int)

SetPriority sets the output priority for the logger.

func (*Logger) SetPriorityString Uses

func (me *Logger) SetPriorityString(s string) error

SetPriorityString sets the output priority by the name of a debug level

func (*Logger) Trace Uses

func (me *Logger) Trace(v ...interface{})

Trace prints to the standard logger with the Trace level.

func (*Logger) Tracef Uses

func (me *Logger) Tracef(format string, v ...interface{})

Tracef prints to the standard logger with the Trace level.

func (*Logger) Traceln Uses

func (me *Logger) Traceln(v ...interface{})

Traceln prints to the standard logger with the Trace level.

func (*Logger) Warn Uses

func (me *Logger) Warn(v ...interface{})

Warn prints to the standard logger with the Warn level.

func (*Logger) Warnf Uses

func (me *Logger) Warnf(format string, v ...interface{})

Warnf prints to the standard logger with the Warn level.

func (*Logger) Warnln Uses

func (me *Logger) Warnln(v ...interface{})

Warnln prints to the standard logger with the Warn level.

Directories

PathSynopsis
fataltests

Package loglevel imports 5 packages (graph) and is imported by 3 packages. Updated 2016-07-19. Refresh now. Tools for package owners.