Documentation ¶
Index ¶
- Constants
- Variables
- func DayLogRecord(flag int, format string, v ...interface{})
- func Debug(msg string, fields ...zapcore.Field)
- func Debugf(format string, args ...interface{})
- func Error(msg string, fields ...zapcore.Field)
- func Errorf(format string, args ...interface{})
- func Fatal(msg string, fields ...zapcore.Field)
- func Info(msg string, fields ...zapcore.Field)
- func Infof(format string, args ...interface{})
- func Init(serverType string, config *viper.Viper)
- func InitDayLog(v *viper.Viper) bool
- func Panic(msg string, fields ...zapcore.Field)
- func Panicf(format string, args ...interface{})
- func SetLogger(l Logger)
- func Warn(msg string, fields ...zapcore.Field)
- func Warnf(format string, args ...interface{})
- type AsyncMsg
- type DayLog
- type DayLogMgr
- type LogConfig
- type Logger
Constants ¶
View Source
const ASYNC_CHANNEL_SIZE = 10000
Variables ¶
View Source
var Log = initLogger()
Log is the default logger
Functions ¶
func DayLogRecord ¶ added in v0.1.0
异步写log
Types ¶
type DayLog ¶ added in v0.1.0
type DayLog struct { Cfg *LogConfig //配置 Instance *logs.BeeLogger //日志实例 LogName string //配置的名字 Dir string //路径 CurLogName string //当前使用的名字 CurHours int //当前点数 }
daylog
type DayLogMgr ¶ added in v0.1.0
beego logs模块单协程只支持单文件读写,不支持单协程多文件读写,daylog一般都是多文件读写,为节约资源,参照beego logs模块中的log.go文件改造
type LogConfig ¶ added in v0.1.0
type LogConfig struct { FilePath string //文件路径 FileName string `json:"filename"` //文件名字 Level int `json:"level"` // 日志保存的时候的级别,默认是 Trace 级别 Maxlines int `json:"maxlines"` // 每个文件保存的最大行数,默认值 1000000 Maxsize int `json:"maxsize"` // 每个文件保存的最大尺寸,默认值是 1 << 28, //256 MB Daily bool `json:"daily"` // 是否按照每天 logrotate,默认是 true Maxdays int `json:"maxdays"` // 文件最多保存多少天,默认保存 7 天 Rotate bool `json:"rotate"` // 是否开启 logrotate,默认是 true Perm string `json:"perm"` // 日志文件权限 RotatePerm string `json:"rotateperm"` Color bool //是否支持颜色 }
type Logger ¶
type Logger interface { Fatal(format ...interface{}) Fatalf(format string, args ...interface{}) Fatalln(args ...interface{}) Debug(args ...interface{}) Debugf(format string, args ...interface{}) Debugln(args ...interface{}) Error(args ...interface{}) Errorf(format string, args ...interface{}) Errorln(args ...interface{}) Info(args ...interface{}) Infof(format string, args ...interface{}) Infoln(args ...interface{}) Warn(args ...interface{}) Warnf(format string, args ...interface{}) Warnln(args ...interface{}) }
Logger represents the log interface
Click to show internal directories.
Click to hide internal directories.