1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-19 09:02:39 +08:00

temporary

This commit is contained in:
2022-07-29 09:46:29 +08:00
parent 135b3a983b
commit 35751f7fdb
14 changed files with 153 additions and 56 deletions

View File

@ -4,6 +4,7 @@ import (
"io"
"log"
"os"
"time"
"github.com/charlienet/go-mixed/fs"
"github.com/sirupsen/logrus"
@ -32,11 +33,12 @@ type LogrusOutputOptions struct {
}
type LogrusBackupOptions struct {
MaxSize int // 默认大小100M
MaxAge int // 备份保留天数
MaxBackups int // 备份保留数
LocalTime bool // 使用本地时间
Compress bool // 是否压缩备份
BackupType Rotate // 分割类型
MaxSize int // 默认大小100M
MaxAge int // 备份保留
MaxBackups int // 备份保留数量
LocalTime bool // 使用本地时间
Compress bool // 是否压缩备份
}
func (o LogrusBackupOptions) hasBackup() bool {
@ -66,6 +68,7 @@ func WithFormatter(formatter logrus.Formatter) logrusOption {
}
func WithOutput(options LogrusOutputOptions) logrusOption {
_ = time.Now()
return func(l *logrus.Logger) {
var writer io.Writer
switch {