1Panel/core/log/config.go
KOMATA 8656dada06
fix: correct suitable log queue size to improve performance (#11008)
* fix: Update log queue size to improve performance and ensure proper handling of log entries

* fix: Adjust log queue size to maintain consistency with queue size limit
2025-11-20 16:28:03 +08:00

44 lines
838 B
Go

package log
import (
"errors"
"io"
"os"
"path"
"github.com/1Panel-dev/1Panel/core/constant"
)
var (
BufferSize = 0x100000
DefaultFileMode = os.FileMode(constant.DirPerm)
DefaultFileFlag = os.O_RDWR | os.O_CREATE | os.O_APPEND
ErrInvalidArgument = errors.New("error argument invalid")
QueueSize = 1024
LogQueueSize = 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
}