Documentation
¶
Overview ¶
Package logging manages log file creation, rotation, and filtering for non-critical messages when verbose mode is off.
Index ¶
Constants ¶
const MaxLogSize = 5 * 1024 * 1024
MaxLogSize is the threshold for log rotation (5MB)
Variables ¶
var NonCriticalPrefixes = []string{
"[~] Modo prueba activado",
"[>] Peso enviado",
"[!] No se recibió peso significativo",
"[i] Configuración sin cambios",
"[i] Iniciando escucha",
"[i] Terminando escucha",
"[+] Cliente conectado",
"[-] Cliente desconectado",
}
NonCriticalPrefixes are log messages filtered when verbose=false
Functions ¶
func GetFileSize ¶
GetFileSize returns the size of the log file in bytes
func ReadLastNLines ¶
ReadLastNLines reads the last n lines from a file efficiently
func RotateIfNeeded ¶
RotateIfNeeded truncates the log file if it exceeds MaxLogSize Keeps the last 1000 lines for continuity
Types ¶
type FilteredLogger ¶
type FilteredLogger struct {
// contains filtered or unexported fields
}
FilteredLogger wraps a file writer with verbose filtering
func NewFilteredLogger ¶
NewFilteredLogger creates a logger that can filter non-critical messages
type Manager ¶
Manager handles log file lifecycle and configuration
func (*Manager) GetVerbose ¶
GetVerbose returns current verbose setting
func (*Manager) SetVerbose ¶
SetVerbose updates the verbose setting