log

package
v0.0.0-...-9267d5d Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ldebug        = 1 << iota //
	Linfo                     //
	Lwarn                     //
	Lerror                    //
	Lfatal                    //
	LAsync                    // 异步输出日志
	Ldate                     // like 2006/01/02
	Ltime                     // like 15:04:05
	Lmicroseconds             // like 15:04:05.123123
	Llongfile                 // like /a/b/c/d.go:23
	Lshortfile                // like d.go:23
	LUTC                      // 时间utc输出
	Ldaily                    //

	Lall = Ldebug | Linfo | Lwarn | Lerror | Lfatal
	// 2006/01/02 15:04:05.123123, /a/b/c/d.go:23
	LstdFlags = Ldate | Lmicroseconds | Lshortfile | Lall
)
View Source
const (
	Gray = uint8(iota + 90)
	Red
	Green
	Yellow
	Blue
	Magenta
)

Variables

View Source
var Std = New(LogOption{Out: os.Stdout, ChannelLen: 1000, Flag: LstdFlags})

standard wrapper

Functions

func Breakpoint

func Breakpoint()

func CallerStack

func CallerStack() string

func Debug

func Debug(v ...interface{})

func Debugf

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

func Error

func Error(v ...interface{})

func Errorf

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

func Fatal

func Fatal(v ...interface{})

func Fatalf

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

func Info

func Info(v ...interface{})

func Infof

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

func Print

func Print(v ...interface{})

func Printf

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

func SetEmail

func SetEmail(email string)

func SetLevel

func SetLevel(lvl int)

func SetObj

func SetObj(obj string)

func SetOutput

func SetOutput(w io.Writer)

func Warn

func Warn(v ...interface{})

func Warnf

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

Types

type LogOption

type LogOption struct {
	Out        io.Writer // 输出writer
	LogDir     string    // 日志输出目录,,为空不输出到文件
	ChannelLen int       // channel
	Flag       int       // 标志位
	Emails     []string  // 告警邮件
}

type Logger

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

func New

func New(option LogOption) *Logger

func (*Logger) Breakpoint

func (l *Logger) Breakpoint()

func (*Logger) Debug

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

func (*Logger) Debugf

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

debug

func (*Logger) Error

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

func (*Logger) Errorf

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

error

func (*Logger) Fatal

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

func (*Logger) Fatalf

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

fatal

func (*Logger) Info

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

func (*Logger) Infof

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

info

func (*Logger) Output

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

log format: date, time(hour:minute:second:microsecond), level, module, shortfile:line, <content>

func (*Logger) Print

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

func (*Logger) Printf

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

print

func (*Logger) SetEmail

func (l *Logger) SetEmail(v string)

func (*Logger) SetLevel

func (l *Logger) SetLevel(lvl int)

func (*Logger) SetLogDir

func (l *Logger) SetLogDir(dir string)

func (*Logger) SetObj

func (l *Logger) SetObj(obj string)

func (*Logger) SetOutput

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

func (*Logger) WaitFlush

func (l *Logger) WaitFlush()

func (*Logger) Warn

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

func (*Logger) Warnf

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

warn

Jump to

Keyboard shortcuts

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