Skip to main content

Module logger

Module logger 

Source
Expand description

Logging module for codesearch

Provides centralized logging configuration with:

  • Daily log file rotation (via tracing-appender)
  • Periodic cleanup of old log files (by age and count)
  • Per-database log storage in .codesearch.db/logs/
  • Configurable via environment variables

Daily rotation creates files named codesearch.log.YYYY-MM-DD. Cleanup removes files older than retention_days and enforces max_files.

Structs§

LogRotationConfig
Log rotation configuration

Enums§

LogLevel
Log level configuration
LoggerInitResult
Result of logger initialization, indicating whether file logging is active

Functions§

cleanup_old_logs
Remove old log files based on retention period and max file count.
ensure_log_dir
Ensure the log directory exists
get_log_dir
Get the log directory path for a given database path
init_logger
Initialize the logger with file rotation and optional console output.
start_cleanup_task
Start periodic log cleanup task.