Documentation ¶
Overview ¶
Package logs 日志类库.
包括 Debug, Info, Warn, Error. 支持控制台输出,文件输入,文件滚动输出.
Index ¶
- Variables
- func Panic(err error)
- func PanicBool(b bool, err error) bool
- func PanicBytes(bs []byte, err error) []byte
- func PanicInt(i int, err error) int
- func PanicInt32(i int32, err error) int32
- func PanicInt64(i int64, err error) int64
- func PanicString(str string, err error) string
- func PanicU32(i uint32, err error) uint32
- func PanicU64(i uint64, err error) uint64
- func SetFlags(f int)
- func SetLevel(logLevel LogLevel)
- func SetLogger(elems ...Logger)
- type LogLevel
- type Logger
- type WriteCloser
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Error 错误. Error = doError // ErrorStack 错误及堆栈. ErrorStack = doErrorStack // Warn 警告. Warn = doWarn // Info 提示. Info = doInfo // Debug 调试. Debug = doDebug )
nolint: gochecknoglobals
View Source
var BaseLogger = &baseLogger{ deb: log.New(os.Stderr, "DEBUG: ", flag), inf: log.New(os.Stderr, "INFO: ", flag), war: log.New(os.Stderr, "WARN: ", flag), err: log.New(os.Stderr, "ERROR: ", flag), }
BaseLogger 基础日志. nolint: gochecknoglobals
Functions ¶
func PanicString ¶ added in v1.0.38
PanicString 字符串返回.
Types ¶
type Logger ¶
type Logger interface { // Error 错误. Error(...interface{}) // ErrorStack 错误及堆栈. ErrorStack(...interface{}) // Warn 警告. Warn(...interface{}) // Info 提示. Info(...interface{}) // Debug 调试. Debug(...interface{}) // SetFlags 设置标记. SetFlags(int) // 关闭. Close() }
Logger 日志器.
func FileLogger ¶
FileLogger 新建文件日志. file 默认日志, error 日志, warn 日志, info 日志.
Click to show internal directories.
Click to hide internal directories.