1Panel/backend/log/config.go

42 lines
752 B
Go
Raw Normal View History

2022-12-08 21:27:49 +08:00
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 {
2022-12-08 21:40:53 +08:00
TimeTagFormat string
LogPath string
FileName string
LogSuffix string
2022-12-08 21:40:53 +08:00
MaxRemain int
RollingTimePattern string
2022-12-08 21:27:49 +08:00
}
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
2022-12-08 21:27:49 +08:00
return
}