Documentation
¶
Overview ¶
* @Author: cnzf1 * @Date: 2019-01-26 15:20:02 * @LastEditors: cnzf1 * @LastEditTime: 2023-03-17 18:36:58 * @Description: 日志组件封装
Index ¶
- func Debug(args ...interface{})
- func Debugf(fmt string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(fmt string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(fmt string, args ...interface{})
- func Info(args ...interface{})
- func Infof(fmt string, args ...interface{})
- func Init(opts ...OptionFunc)
- func Panic(args ...interface{})
- func Panicf(fmt string, args ...interface{})
- func SetLogLevel(lvl string)
- func Warn(args ...interface{})
- func Warnf(fmt string, args ...interface{})
- type OptionFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(opts ...OptionFunc)
func SetLogLevel ¶
func SetLogLevel(lvl string)
Types ¶
type OptionFunc ¶ added in v1.2.0
type OptionFunc func(c *config)
func WithBackups ¶ added in v1.2.0
func WithBackups(maxBackups int) OptionFunc
WithBackups alters the max num of old log files to retain, default 10
func WithCompress ¶ added in v1.2.0
func WithCompress(compress bool) OptionFunc
WithCompress determines if the rotated log files should be compressed, default false
func WithLevel ¶ added in v1.2.0
func WithLevel(level string) OptionFunc
WithLevel alters the log output level, options: debug/info/warn/error
func WithMaxAge ¶ added in v1.2.0
func WithMaxAge(maxAge int) OptionFunc
WithMaxAge alters the max num of days to retain old log files, default 7 days
func WithMaxSize ¶ added in v1.2.0
func WithMaxSize(maxSize int) OptionFunc
WithMaxSize alters the max size of a single log file, default 100Mbit
func WithPath ¶ added in v1.2.0
func WithPath(filename string) OptionFunc
WithPath alters the saved log full path, for example "./log/debug.log"
Click to show internal directories.
Click to hide internal directories.