logger

package
v0.0.0-...-b87ab60 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LEVEL_FATAL = iota
	LEVEL_ERROR
	LEVEL_WARN
	LEVEL_INFO
	LEVEL_DEBUG
)

Variables

This section is empty.

Functions

func ChangeLogFMT

func ChangeLogFMT(sep string, trim bool, enableAppName bool)

func Debug

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

Debug 输出Debug级别日志

func Error

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

Error 输出Error级别日志

func Fatal

func Fatal(format string, args ...interface{})

Fatal 输出Fatal级别日志

func GetLogLevel

func GetLogLevel() int

func GetLogLevelToString

func GetLogLevelToString(l int) string

func Info

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

Info 输出Info级别日志

func InitLogger

func InitLogger(cfg *cfgargs.SrvConfig)

InitLogger 初始化Logger单实例对象

func Warn

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

Warn 输出Warn级别日志

Types

type LogWriter

type LogWriter interface {
	Open(logPath string) error
	WriteString(s string) (n int, err error)
	Write([]byte) (n int, err error)
	Close()
	Flush()
}

func MultiWriter

func MultiWriter(writers ...LogWriter) LogWriter

type Logger

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

func DefLogger

func DefLogger() *Logger

DefLogger 获取默认的Logger对象

func (*Logger) GetBinname

func (l *Logger) GetBinname() string

func (*Logger) GetLogWriters

func (l *Logger) GetLogWriters() []LogWriter

func (*Logger) WriteLog

func (l *Logger) WriteLog(logLevel int, msg string, v ...interface{})

type LoggerWriterConsole

type LoggerWriterConsole struct {
}

func NewLoggerWriterConsole

func NewLoggerWriterConsole() *LoggerWriterConsole

func (*LoggerWriterConsole) Close

func (l *LoggerWriterConsole) Close()

func (*LoggerWriterConsole) Flush

func (l *LoggerWriterConsole) Flush()

func (*LoggerWriterConsole) Open

func (l *LoggerWriterConsole) Open(logPath string) error

func (*LoggerWriterConsole) Write

func (l *LoggerWriterConsole) Write(b []byte) (n int, err error)

func (*LoggerWriterConsole) WriteString

func (l *LoggerWriterConsole) WriteString(s string) (n int, err error)

type LoggerWriterFile

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

func NewLoggerWriterFile

func NewLoggerWriterFile() *LoggerWriterFile

func (*LoggerWriterFile) Close

func (l *LoggerWriterFile) Close()

func (*LoggerWriterFile) Flush

func (l *LoggerWriterFile) Flush()

func (*LoggerWriterFile) Open

func (l *LoggerWriterFile) Open(logPath string) error

func (*LoggerWriterFile) Write

func (l *LoggerWriterFile) Write(b []byte) (n int, err error)

func (*LoggerWriterFile) WriteString

func (l *LoggerWriterFile) WriteString(s string) (n int, err error)

Jump to

Keyboard shortcuts

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