Files
go-service/internal/logger/config.go
2026-07-17 15:57:05 +03:00

42 lines
1.5 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Package logger реализует хранение данных GPIO: разбор байта, бинарные
// почасовые логи с ротацией, человекочитаемые и событийные логи, watchdog
// тишины и retention (автоочистку старых файлов). Пути хранения зависят от
// режима работы (deb-пакет или разработка) и вычисляются в paths.go.
package logger
import "time"
// Config содержит настройки для всех компонентов логирования
type Config struct {
// Retention настройки
RetentionHours int
RetentionMB int
RetentionIntervalMin time.Duration
// Мониторинг тишины
Silence5Min time.Duration
Silence10Min time.Duration
WatchdogIntervalMin time.Duration
// Анти-спам и интервалы
AlertCooldownSec time.Duration
HumanLogIntervalSec time.Duration
// Буфер
BufferSize int
}
// DefaultConfig возвращает конфигурацию по умолчанию
func DefaultConfig() *Config {
return &Config{
RetentionHours: 48,
RetentionMB: 5000,
RetentionIntervalMin: 15 * time.Minute,
Silence5Min: 5 * time.Minute,
Silence10Min: 10 * time.Minute,
WatchdogIntervalMin: 1 * time.Minute,
AlertCooldownSec: 10 * time.Second,
HumanLogIntervalSec: 5 * time.Second,
BufferSize: 10240,
}
}