log

package module
v0.0.0-...-3699970 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: Apache-2.0 Imports: 7 Imported by: 32

Documentation

Index

Constants

View Source
const (
	// Bits 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:
	//	[log] 2009/01/23 01:23:23.123123 /a/b/c/d.go:23: message
	Ldate         = log.Ldate                                                         // the date: 2009/01/23
	Ltime         = log.Ltime                                                         // the time: 01:23:23
	Lmicroseconds = log.Lmicroseconds                                                 // microsecond resolution: 01:23:23.123123.  assumes Ltime.
	Llongfile     = log.Llongfile                                                     // full file name and line number: /a/b/c/d.go:23
	Lshortfile    = log.Lshortfile                                                    // final file name element and line number: d.go:23. overrides Llongfile
	LUTC          = log.LUTC                                                          // if Ldate or Ltime is set, use UTC rather than the local time zone
	Lpackage      = log.LUTC << 1                                                     // package name: [log]
	Lfunction     = Lpackage << 1                                                     // function name: <Print>
	LstdFlags     = Ldate | Ltime | Lmicroseconds | Lshortfile | Lpackage | Lfunction // initial values for the standard logger
	Ldevelop      = Ldate | Ltime | Lmicroseconds | Llongfile | Lpackage | Lfunction
	Lproduction   = Ldate | Ltime | Lmicroseconds | Lpackage | Lfunction
)

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

View Source
const (
	LEVEL_DISABLE = 0 //关闭日志功能
	LEVEL_DEBUG   = 1 << iota
	LEVEL_INFO
	LEVEL_WARN
	LEVEL_ERROR
	LEVEL_CRITICAL
	LEVEL_PANIC
)

日志级别

View Source
const (
	LEVEL_FATAL = "[FATAL]"
	LEVEL_ALL   = LEVEL_DEBUG | LEVEL_INFO | LEVEL_WARN | LEVEL_ERROR | LEVEL_CRITICAL | LEVEL_PANIC

	//默认日志级别为
	LEVEL_DEFAULT = LEVEL_ALL
)

Variables

View Source
var (
	LevelText = map[string]int{
		"disable":  LEVEL_DISABLE,
		"debug":    LEVEL_DEBUG,
		"info":     LEVEL_INFO,
		"warn":     LEVEL_WARN,
		"error":    LEVEL_ERROR,
		"critical": LEVEL_CRITICAL,
		"panic":    LEVEL_PANIC,
		"all":      LEVEL_ALL,
	}
)

Functions

func Critical

func Critical(v ...interface{})

func Criticalf

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

func Criticalln

func Criticalln(v ...interface{})

func Debug

func Debug(v ...interface{})

func Debugf

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

func Debugln

func Debugln(v ...interface{})

func Error

func Error(v ...interface{})

func Errorf

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

func Errorln

func Errorln(v ...interface{})

func Fatal

func Fatal(v ...interface{})

func Fatalf

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

func Fatalln

func Fatalln(v ...interface{})

func Flags

func Flags() int

func Info

func Info(v ...interface{})

func Infof

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

func Infoln

func Infoln(v ...interface{})

func Levels

func Levels() int

func Panic

func Panic(v ...interface{})

func Panicf

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

func Panicln

func Panicln(v ...interface{})

func ParseLevel

func ParseLevel(level string) int

func Print

func Print(v ...interface{})

func Printf

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

func Println

func Println(v ...interface{})

func SetFlags

func SetFlags(flag int)

func SetLevel

func SetLevel(level interface{})

func SetOutput

func SetOutput(w io.Writer)

func Warn

func Warn(v ...interface{})

func Warnf

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

func Warnln

func Warnln(v ...interface{})

Types

type Logger

type Logger struct {
	*log.Logger
	// contains filtered or unexported fields
}

func New

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

func (*Logger) Critical

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

func (*Logger) Criticalf

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

func (*Logger) Criticalln

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

func (*Logger) Debug

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

func (*Logger) Debugf

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

func (*Logger) Debugln

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

func (*Logger) Error

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

func (*Logger) Errorf

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

func (*Logger) Errorln

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

func (*Logger) Fatal

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

func (*Logger) Fatalf

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

func (*Logger) Fatalln

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

func (*Logger) Info

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

func (*Logger) Infof

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

func (*Logger) Infoln

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

func (*Logger) Levels

func (l *Logger) Levels() int

func (*Logger) Output

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

func (*Logger) Panic

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

func (*Logger) Panicf

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

func (*Logger) Panicln

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

func (*Logger) Print

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

func (*Logger) Printf

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

func (*Logger) Println

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

func (*Logger) SetLevel

func (l *Logger) SetLevel(level interface{})

func (*Logger) SetOutput

func (l *Logger) SetOutput(w io.Writer)

func (*Logger) Warn

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

func (*Logger) Warnf

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

func (*Logger) Warnln

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

Jump to

Keyboard shortcuts

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