Documentation
¶
Index ¶
- func Close() error
- func Debug(format string, args ...interface{})
- func Error(err error, format string, args ...interface{})
- func Info(format string, args ...interface{})
- func InitDefaultLogger(logger Logger)
- func Log(format string, args ...interface{})
- func Warn(format string, args ...interface{})
- type Level
- type Logger
- func DefaultLogger() Logger
- func NewConsoleLogger(level Level) Logger
- func NewEmptyLogger() Logger
- func NewFileLogger(level Level, logDir string, filePrefix string) (Logger, error)
- func NewFileLoggerWithAutoFlush(level Level, logDir string, filePrefix string, autoFlush bool, ...) (Logger, error)
- func NewMultiLogger(loggers ...Logger) Logger
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitDefaultLogger ¶
func InitDefaultLogger(logger Logger)
InitDefaultLogger init a default logger if InitDefaultLogger is not called, default is consoleLogger with InfoLevel
Types ¶
type Logger ¶
type Logger interface { Debug(format string, args ...interface{}) Info(format string, args ...interface{}) Warn(format string, args ...interface{}) Error(err error, format string, args ...interface{}) Writer }
Logger define a universal log interface
func DefaultLogger ¶
func DefaultLogger() Logger
func NewConsoleLogger ¶
NewConsoleLogger get a console logger
func NewEmptyLogger ¶
func NewEmptyLogger() Logger
NewEmptyLogger get an empty logger, there is nothing to do
func NewFileLogger ¶
NewFileLogger get a file logger
func NewFileLoggerWithAutoFlush ¶
func NewFileLoggerWithAutoFlush(level Level, logDir string, filePrefix string, autoFlush bool, flushInterval time.Duration) (Logger, error)
NewFileLoggerWithAutoFlush get a file logger
func NewMultiLogger ¶
NewMultiLogger get a multi logger, write log to multiple loggers
Source Files
¶
Click to show internal directories.
Click to hide internal directories.