Documentation
¶
Index ¶
- Constants
- func Black(buffer *bytes.Buffer)
- func Blue(buffer *bytes.Buffer)
- func Cyan(buffer *bytes.Buffer)
- func Green(buffer *bytes.Buffer)
- func Purple(buffer *bytes.Buffer)
- func Red(buffer *bytes.Buffer)
- func White(buffer *bytes.Buffer)
- func Yellow(buffer *bytes.Buffer)
- type Config
- type ErrorInfo
- type HandlerFunc
- type Logger
- func (l *Logger) Debug(v ...interface{})
- func (l *Logger) Debugf(format string, v ...interface{})
- func (l *Logger) Error(v ...interface{})
- func (l *Logger) ErrorSend(s ErrorInfo)
- func (l *Logger) Errorf(format string, v ...interface{})
- func (l *Logger) Fatal(v ...interface{})
- func (l *Logger) Fatalf(f string, v ...interface{})
- func (l *Logger) GetLevel() int
- func (l *Logger) Info(v ...interface{})
- func (l *Logger) Infof(format string, v ...interface{})
- func (l *Logger) Panic(v ...interface{})
- func (l *Logger) Panicf(format string, v ...interface{})
- func (l *Logger) SetConfig(config Config) error
- func (l *Logger) SetErrorSend(h HandlerFunc)
- func (l *Logger) SetLevel(level int)
- func (l *Logger) Warning(v ...interface{})
- func (l *Logger) Warningf(format string, v ...interface{})
Constants ¶
View Source
const ( F_ASYNC = 1 << iota // Print logging content asynchronously。 F_FILE_LONG // Print full file name and line number: /a/b/c/d.go:23. F_FILE_SHORT // Print final file name element and line number: d.go:23. overrides F_FILE_LONG. F_TIME_DATE // Print the date in the local time zone: 2009-01-23. F_TIME_TIME // Print the time in the local time zone: 01:23:23. F_TIME_MILLI // Print the time with milliseconds in the local time zone: 01:23:23.675. F_CALLER_FN // Print Caller function name and package: main.main F_TIME_STD = F_TIME_DATE | F_TIME_MILLI | F_FILE_LONG )
View Source
const ( LEVEL_ALL = LEVEL_DEBU | LEVEL_INFO | LEVEL_NOTI | LEVEL_WARN | LEVEL_ERRO | LEVEL_CRIT | LEVEL_ERRO_SEND LEVEL_DEV = LEVEL_ALL //开发环境 LEVEL_PROD = LEVEL_WARN | LEVEL_ERRO | LEVEL_CRIT | LEVEL_ERRO_SEND //生成环境 LEVEL_DEBU = 1 << iota // 8 LEVEL_INFO // 16 LEVEL_NOTI // 32 LEVEL_WARN // 64 LEVEL_ERRO // 128 LEVEL_ERRO_SEND // 128 LEVEL_CRIT // 256 LEVEL_PANI // 512 LEVEL_FATA // 1024 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Level int //日志等级 Flags int // Extra flags for logging output features. Path string // Logging directory path. Prefix string // Prefix string for every logging content. StSkip int // Skip count for stack. StStatus int // Stack status(1: enabled - default; 0: disabled) HeaderPrint bool `c:"header"` // Print header or not(true in default). StdoutPrint bool `c:"stdout"` // Output to stdout or not(true in default). LevelPrefixes map[int]string // Logging level to its prefix string mapping. RotateSize int64 // Rotate the logging file if its size > 0 in bytes. }
func DefaultConfig ¶
func DefaultConfig() Config
type ErrorInfo ¶
type ErrorInfo struct { Error string //报错接口 Code interface{} //错误码 Msg interface{} //错误消息 }
type HandlerFunc ¶
type HandlerFunc func(ErrorInfo)
Click to show internal directories.
Click to hide internal directories.