log

package
v0.0.0-...-82e7740 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2019 License: MIT Imports: 5 Imported by: 36

README

comm-log GoDoc

log library for Go

Installation

go get gopkg.in/goyy/goyy.v0/comm/log

Priority

Ptrace < Pdebug < Pinfo < Pwarn < Perror < Pcritical < Pprint

Usage

log.SetPrefix("[log]")
log.SetPriority(log.Perror)
log.SetLayouts(log.Lstd | log.Llongfile)
log.Trace("=====trace=====")
log.Debug("=====debug=====")
log.Info("=====info=====")
log.Warn("=====warn=====")
log.Error("=====error=====")
log.Critical("=====critical=====")
log.Print("=====print=====")

logging := log.New("[logging]")
logging.Trace("=====trace=====")
logging.Debug("=====debug=====")
logging.Info("=====info=====")
logging.Warn("=====warn=====")
logging.Error("=====error=====")
logging.Critical("=====critical=====")
logging.Print("=====print=====")

Documentation

Overview

Package log implements a simple logging package.

Index

Constants

View Source
const (
	Pall = iota
	Ptrace
	Pdebug
	Pinfo
	Pwarn
	Perror
	Pcritical
	Pprint
	Poff
)

Priority used for identifying the severity of an event.

View Source
const (
	// Debug 2012/01/23 01:23:23.123123 /a/b/c/d.go:23: message
	Ldate         = 1 << iota     // the date in the local time zone: 2009/01/23
	Ltime                         // the time in the local time zone: 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
	LUTC                          // if Ldate or Ltime is set, use UTC rather than the local time zone
	Lpriority                     // the priority: Debug
	LstdFlags     = Ldate | Ltime // initial values for the standard logger
)

These layouts define which text to prefix to each log entry generated by the Logger.

View Source
const (
	Oconsole     = 1 << iota             // the console logger
	Odailyfile                           // the daily file logger
	Orollingfile                         // the rolling file logger
	Ostd         = Oconsole | Odailyfile // the console|daily file logger
)

sets the outputs destination for the logger.

Variables

This section is empty.

Functions

func Critical

func Critical(v ...interface{})

Critical calls Output to print to the logger with the Critical priority.

func Criticalf

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

Criticalf calls Output to printf to the logger with the Critical priority.

func Criticalln

func Criticalln(v ...interface{})

Criticalln calls Output to println to the logger with the Critical priority.

func Debug

func Debug(v ...interface{})

Debug calls Output to print to the logger with the Debug priority.

func Debugf

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

Debugf calls Output to printf to the logger with the Debug priority.

func Debugln

func Debugln(v ...interface{})

Debugln calls Output to println to the logger with the Debug priority.

func Error

func Error(v ...interface{})

Error calls Output to print to the logger with the Error priority.

func Errorf

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

Errorf calls Output to printf to the logger with the Error priority.

func Errorln

func Errorln(v ...interface{})

Errorln calls Output to println to the logger with the Error priority.

func Info

func Info(v ...interface{})

Info calls Output to print to the logger with the Info priority.

func Infof

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

Infof calls Output to printf to the logger with the Info priority.

func Infoln

func Infoln(v ...interface{})

Infoln calls Output to println to the logger with the Info priority.

func Layouts

func Layouts() int

Layouts returns the output layouts for the logger.

func Prefix

func Prefix() string

Prefix returns the output prefix for the logger.

func Print

func Print(v ...interface{})

Print calls Output to print to the logger with the Print priority.

func Printf

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

Printf calls Output to printf to the logger with the Print priority.

func Println

func Println(v ...interface{})

Println calls Output to println to the logger with the Print priority.

func Priority

func Priority() int

Priority returns the output priority for the logger.

func SetDefaultDir

func SetDefaultDir(value string)

SetDefaultDir set the default dir.

func SetDefaultLayout

func SetDefaultLayout(value int)

SetDefaultLayout set the default layout.

func SetDefaultOutput

func SetDefaultOutput(value int)

SetDefaultOutput set the default output.

func SetDefaultPriority

func SetDefaultPriority(value int)

SetDefaultPriority set the default priority.

func SetLayouts

func SetLayouts(value int)

SetLayouts sets the output layouts for the logger.

func SetPrefix

func SetPrefix(value string)

SetPrefix sets the output prefix for the logger.

func SetPriority

func SetPriority(value int)

SetPriority sets the output priority for the logger.

func Trace

func Trace(v ...interface{})

Trace calls Output to print to the logger with the Trace priority.

func Tracef

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

Tracef calls Output to printf to the logger with the Trace priority.

func Traceln

func Traceln(v ...interface{})

Traceln calls Output to println to the logger with the Trace priority.

func Warn

func Warn(v ...interface{})

Warn calls Output to print to the logger with the Warn priority.

func Warnf

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

Warnf calls Output to printf to the logger with the Warn priority.

func Warnln

func Warnln(v ...interface{})

Warnln calls Output to println to the logger with the Warn priority.

Types

type Logger

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

Logger logger.

func NewLogger

func NewLogger(out io.Writer) *Logger

NewLogger creates a new Logger.

func (*Logger) Critical

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

Critical calls output to print to the logger with the Critical priority.

func (*Logger) Criticalf

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

Criticalf calls output to printf to the logger with the Critical priority.

func (*Logger) Criticalln

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

Criticalln calls output to println to the logger with the Critical priority.

func (*Logger) Debug

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

Debug calls output to print to the logger with the Debug priority.

func (*Logger) Debugf

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

Debugf calls output to printf to the logger with the Debug priority.

func (*Logger) Debugln

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

Debugln calls output to println to the logger with the Debug priority.

func (*Logger) Error

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

Error calls output to print to the logger with the Error priority.

func (*Logger) Errorf

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

Errorf calls output to printf to the logger with the Error priority.

func (*Logger) Errorln

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

Errorln calls output to println to the logger with the Error priority.

func (*Logger) Info

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

Info calls output to print to the logger with the Info priority.

func (*Logger) Infof

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

Infof calls output to printf to the logger with the Info priority.

func (*Logger) Infoln

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

Infoln calls output to println to the logger with the Info priority.

func (*Logger) Layouts

func (me *Logger) Layouts() int

Layouts returns the output layouts for the logger.

func (*Logger) Prefix

func (me *Logger) Prefix() string

Prefix returns the output prefix for the logger.

func (*Logger) Print

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

Print calls output to print to the logger with the Print priority.

func (*Logger) Printf

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

Printf calls output to printf to the logger with the Print priority.

func (*Logger) Println

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

Println calls output to println to the logger with the Print priority.

func (*Logger) Priority

func (me *Logger) Priority() int

Priority returns the output priority for the logger.

func (*Logger) SetLayouts

func (me *Logger) SetLayouts(layouts int)

SetLayouts sets the output layouts for the logger.

func (*Logger) SetPrefix

func (me *Logger) SetPrefix(prefix string)

SetPrefix sets the output prefix for the logger.

func (*Logger) SetPriority

func (me *Logger) SetPriority(priority int)

SetPriority sets the output priority for the logger.

func (*Logger) Trace

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

Trace calls output to print to the logger with the Trace priority.

func (*Logger) Tracef

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

Tracef calls output to printf to the logger with the Trace priority.

func (*Logger) Traceln

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

Traceln calls output to println to the logger with the Trace priority.

func (*Logger) Warn

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

Warn calls output to print to the logger with the Warn priority.

func (*Logger) Warnf

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

Warnf calls output to printf to the logger with the Warn priority.

func (*Logger) Warnln

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

Warnln calls output to println to the logger with the Warn priority.

type Logging

type Logging struct {
	Settings func() // The function executed before the log is printed and executed only once.
	// contains filtered or unexported fields
}

Logging logging.

func New

func New(prefix string) *Logging

New creates a new Logging.

func NewLogging

func NewLogging(prefix string, priority, layouts, outputs int) *Logging

NewLogging creates a new Logging.

func (*Logging) Critical

func (me *Logging) Critical(v ...interface{})

Critical calls Output to print to the logging with the Critical priority.

func (*Logging) Criticalf

func (me *Logging) Criticalf(format string, v ...interface{})

Criticalf calls Output to printf to the logging with the Critical priority.

func (*Logging) Criticalln

func (me *Logging) Criticalln(v ...interface{})

Criticalln calls Output to println to the logging with the Critical priority.

func (*Logging) Debug

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

Debug calls Output to print to the logging with the Debug priority.

func (*Logging) Debugf

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

Debugf calls Output to printf to the logging with the Debug priority.

func (*Logging) Debugln

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

Debugln calls Output to println to the logging with the Debug priority.

func (*Logging) Error

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

Error calls Output to print to the logging with the Error priority.

func (*Logging) Errorf

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

Errorf calls Output to printf to the logging with the Error priority.

func (*Logging) Errorln

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

Errorln calls Output to println to the logging with the Error priority.

func (*Logging) Info

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

Info calls Output to print to the logging with the Info priority.

func (*Logging) Infof

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

Infof calls Output to printf to the logging with the Info priority.

func (*Logging) Infoln

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

Infoln calls Output to println to the logging with the Info priority.

func (*Logging) Layouts

func (me *Logging) Layouts() int

Layouts returns the output layouts for the logging.

func (*Logging) Outputs

func (me *Logging) Outputs() int

Outputs returns the output outputs for the logging.

func (*Logging) Prefix

func (me *Logging) Prefix() string

Prefix returns the output prefix for the logging.

func (*Logging) Print

func (me *Logging) Print(v ...interface{})

Print calls Output to print to the logging with the Print priority.

func (*Logging) Printf

func (me *Logging) Printf(format string, v ...interface{})

Printf calls Output to printf to the logging with the Print priority.

func (*Logging) Println

func (me *Logging) Println(v ...interface{})

Println calls Output to println to the logging with the Print priority.

func (*Logging) Priority

func (me *Logging) Priority() int

Priority returns the output priority for the logging.

func (*Logging) SetLayouts

func (me *Logging) SetLayouts(value int)

SetLayouts sets the output layouts for the logging.

func (*Logging) SetOutputs

func (me *Logging) SetOutputs(value int)

SetOutputs sets the output outputs for the logging.

func (*Logging) SetPrefix

func (me *Logging) SetPrefix(value string)

SetPrefix sets the output prefix for the logging.

func (*Logging) SetPriority

func (me *Logging) SetPriority(value int)

SetPriority sets the output priority for the logging.

func (*Logging) Trace

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

Trace calls Output to print to the logging with the Trace priority.

func (*Logging) Tracef

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

Tracef calls Output to printf to the logging with the Trace priority.

func (*Logging) Traceln

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

Traceln calls Output to println to the logging with the Trace priority.

func (*Logging) Warn

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

Warn calls Output to print to the logging with the Warn priority.

func (*Logging) Warnf

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

Warnf calls Output to printf to the logging with the Warn priority.

func (*Logging) Warnln

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

Warnln calls Output to println to the logging with the Warn priority.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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