1Panel/core/log/config.go
ssongliu 2ef7b8b3b1
Some checks failed
sync2gitee / repo-sync (push) Failing after -6m49s
feat: core 功能代码拆分
2024-07-19 19:04:11 +08:00

41 lines
752 B
Go

package log
import (
"errors"
"io"
"os"
"path"
)
var (
BufferSize = 0x100000
DefaultFileMode = os.FileMode(0644)
DefaultFileFlag = os.O_RDWR | os.O_CREATE | os.O_APPEND
ErrInvalidArgument = errors.New("error argument invalid")
QueueSize = 1024
ErrClosed = errors.New("error write on close")
)
type Config struct {
TimeTagFormat string
LogPath string
FileName string
LogSuffix string
MaxRemain int
RollingTimePattern string
}
type Manager interface {
Fire() chan string
Close()
}
type RollingWriter interface {
io.Writer
Close() error
}
func FilePath(c *Config) (filepath string) {
filepath = path.Join(c.LogPath, c.FileName) + c.LogSuffix
return
}