Currently, the CsvExporter only writes logs to disk when flush() is explicitly called. This can lead to lost logs if the program crashes or exits without a manual flush.
✅ Proposed Solution
Enhance CsvExporter to support both periodic flushing (every N seconds) and final flushing on program exit using atexit.
Benefits:
-
Logs are flushed regularly in the background
-
Safe shutdown with a final flush
-
No loss of data even if the app exits or is interrupted
configure(
export_type=ExportType.CSV,
export_path="logs/query_log.csv",
flush_interval_seconds=10 # flush every 10 seconds
)
Currently, the CsvExporter only writes logs to disk when flush() is explicitly called. This can lead to lost logs if the program crashes or exits without a manual flush.
✅ Proposed Solution
Enhance CsvExporter to support both periodic flushing (every N seconds) and final flushing on program exit using atexit.
Benefits:
Logs are flushed regularly in the background
Safe shutdown with a final flush
No loss of data even if the app exits or is interrupted