This commit is contained in:
Steve Yegge
2025-11-23 21:42:49 -08:00
6 changed files with 714 additions and 699 deletions

View File

@@ -18,9 +18,9 @@ func (d *daemonLogger) log(format string, args ...interface{}) {
// setupDaemonLogger creates a rotating log file logger for the daemon
func setupDaemonLogger(logPath string) (*lumberjack.Logger, daemonLogger) {
maxSizeMB := getEnvInt("BEADS_DAEMON_LOG_MAX_SIZE", 10)
maxBackups := getEnvInt("BEADS_DAEMON_LOG_MAX_BACKUPS", 3)
maxAgeDays := getEnvInt("BEADS_DAEMON_LOG_MAX_AGE", 7)
maxSizeMB := getEnvInt("BEADS_DAEMON_LOG_MAX_SIZE", 50)
maxBackups := getEnvInt("BEADS_DAEMON_LOG_MAX_BACKUPS", 7)
maxAgeDays := getEnvInt("BEADS_DAEMON_LOG_MAX_AGE", 30)
compress := getEnvBool("BEADS_DAEMON_LOG_COMPRESS", true)
logF := &lumberjack.Logger{

View File

@@ -107,19 +107,19 @@ func TestLogFileRotationDefaults(t *testing.T) {
os.Unsetenv("BEADS_DAEMON_LOG_MAX_AGE")
os.Unsetenv("BEADS_DAEMON_LOG_COMPRESS")
maxSize := getEnvInt("BEADS_DAEMON_LOG_MAX_SIZE", 10)
if maxSize != 10 {
t.Errorf("Expected default max size 10, got %d", maxSize)
maxSize := getEnvInt("BEADS_DAEMON_LOG_MAX_SIZE", 50)
if maxSize != 50 {
t.Errorf("Expected default max size 50, got %d", maxSize)
}
maxBackups := getEnvInt("BEADS_DAEMON_LOG_MAX_BACKUPS", 3)
if maxBackups != 3 {
t.Errorf("Expected default max backups 3, got %d", maxBackups)
maxBackups := getEnvInt("BEADS_DAEMON_LOG_MAX_BACKUPS", 7)
if maxBackups != 7 {
t.Errorf("Expected default max backups 7, got %d", maxBackups)
}
maxAge := getEnvInt("BEADS_DAEMON_LOG_MAX_AGE", 7)
if maxAge != 7 {
t.Errorf("Expected default max age 7, got %d", maxAge)
maxAge := getEnvInt("BEADS_DAEMON_LOG_MAX_AGE", 30)
if maxAge != 30 {
t.Errorf("Expected default max age 30, got %d", maxAge)
}
compress := getEnvBool("BEADS_DAEMON_LOG_COMPRESS", true)