log

package module
v0.0.0-...-25adb9e Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2014 License: MIT Imports: 7 Imported by: 1

README

log

simple golang log package

Documentation

Index

Constants

View Source
const (
	TRACE = iota
	DEBUG
	INFO
	WARN
	ERROR
	FATAL
)
View Source
const (
	Ldate         = 1 << iota // the date: 20090123
	Ltime                     // the time: 01:23:23
	Lmicroseconds             // microsecond resolution: 01:23:23.123123.  assumes Ltime.
	Llevel                    // the log level: TRACE DEBUG INFO...
	Lfile                     // final file name element and line number: d.go:23.
)

Variables

This section is empty.

Functions

func Debug

func Debug(a ...interface{})

func Debugf

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

func Debugfn

func Debugfn(fn logfunc)

func Error

func Error(a ...interface{})

func ErrorOnError

func ErrorOnError(err error)

func Errorf

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

func Errorfn

func Errorfn(fn logfunc)

func Fatal

func Fatal(a ...interface{})

func FatalOnError

func FatalOnError(err error)

func Fatalf

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

func Fatalfn

func Fatalfn(fn logfunc)

func Info

func Info(a ...interface{})

func Infof

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

func Infofn

func Infofn(fn logfunc)

func SetConsoleLogLevel

func SetConsoleLogLevel(level int)

func SetConsolePrefix

func SetConsolePrefix(prefix string)

func SetStatFilePath

func SetStatFilePath(path string)

func SetStatFilePrefix

func SetStatFilePrefix(prefix string)

func Stat

func Stat(a ...interface{})

func Trace

func Trace(a ...interface{})

func Tracef

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

func Tracefn

func Tracefn(fn logfunc)

func Warn

func Warn(a ...interface{})

func WarnOnError

func WarnOnError(err error)

func Warnf

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

func Warnfn

func Warnfn(fn logfunc)

Types

type Logger

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

func NewLogger

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

New creates a new Logger. The out variable sets the destination to which log data will be written. The prefix appears at the beginning of each generated log line. The flag argument defines the logging properties.

func (*Logger) Output

func (l *Logger) Output(level int, s string) error

Output writes the output for a logging event. The string s contains the text to print after the prefix specified by the flags of the Logger. A newline is appended if the last character of s is not already a newline. Calldepth is used to recover the PC and is provided for generality, although at the moment on all pre-defined paths it will be 2.

func (*Logger) SetFlags

func (l *Logger) SetFlags(flag int)

SetFlags sets the output flags for the logger.

func (*Logger) SetPrefix

func (l *Logger) SetPrefix(prefix string)

SetPrefix sets the output prefix for the logger.

func (*Logger) SetWriter

func (l *Logger) SetWriter(writer io.Writer)

Jump to

Keyboard shortcuts

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