mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-12-23 01:24:24 +00:00
Move LogRotationConfig to logger package
This commit is contained in:
@@ -10,19 +10,25 @@ import (
|
||||
"time"
|
||||
|
||||
timber "github.com/DeRuina/timberjack"
|
||||
"llamactl/pkg/config"
|
||||
)
|
||||
|
||||
// LogRotationConfig contains log rotation settings for instances
|
||||
type LogRotationConfig struct {
|
||||
Enabled bool `yaml:"enabled" default:"true"`
|
||||
MaxSizeMB int `yaml:"max_size_mb" default:"100"` // MB
|
||||
Compress bool `yaml:"compress" default:"false"`
|
||||
}
|
||||
|
||||
type logger struct {
|
||||
name string
|
||||
logDir string
|
||||
logFile *timber.Logger
|
||||
logFilePath string
|
||||
mu sync.RWMutex
|
||||
cfg *config.LogRotationConfig
|
||||
cfg *LogRotationConfig
|
||||
}
|
||||
|
||||
func newLogger(name, logDir string, cfg *config.LogRotationConfig) *logger {
|
||||
func newLogger(name, logDir string, cfg *LogRotationConfig) *logger {
|
||||
return &logger{
|
||||
name: name,
|
||||
logDir: logDir,
|
||||
|
||||
Reference in New Issue
Block a user