log

package
v0.0.0-...-1dc6914 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2014 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Log Level
	Emerg = 0
	Alert = 1
	Crit  = 2
	Error = 3
	Warn  = 4
	Notic = 5
	Info  = 6
	Debug = 7
)

Variables

View Source
var (
	DefaultLogger = &Logger{log: log.New(os.Stdout, "", log.LstdFlags), file: nil, level: defaultLogLevel}
)

Functions

This section is empty.

Types

type Logger

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

A Logger represents an active logging object that generates lines of output to an io.Writer. Each logging operation makes a single call to the Writer's Write method. A Logger can be used simultaneously from multiple goroutines; it guarantees to serialize access to the Writer.

func New

func New(file string, levelStr string) (*Logger, error)

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 file argument defines the write log file path. if any error the os.Stdout will return

func (*Logger) Close

func (l *Logger) Close() error

Close closes the open log file.

func (*Logger) Crit

func (l *Logger) Crit(format string, args ...interface{})

Crit use the Crit level write data

func (*Logger) Debug

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

Debug use the Error log level write data

func (*Logger) Error

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

Error use the Error log level write data

func (*Logger) Info

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

Info use the Info log level write data

func (*Logger) Warn

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

Warn use the Warn level write data

Jump to

Keyboard shortcuts

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