ChannelMessageLogger

class ChannelMessageLogger(logsDirectory: Path, plugin: Plugin, logger: Logger, maxFileSizeBytes: Long, retentionDays: Int)(source)

Asynchronous logger for channel messages.

Writes messages in NDJSON format to daily rotated log files. Uses a concurrent queue and scheduled flushing to minimize performance impact.

Constructors

Link copied to clipboard
constructor(logsDirectory: Path, plugin: Plugin, logger: Logger, maxFileSizeBytes: Long, retentionDays: Int)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun cleanupOldLogs(retentionDays: Int)

Deletes log files older than the specified retention period. Handles both base files (YYYY-MM-DD.json) and suffixed files (YYYY-MM-DD-N.json).

Link copied to clipboard

Queues a message for asynchronous logging.

Link copied to clipboard
fun shutdown()

Shuts down the logger by cancelling scheduled tasks and flushing pending entries. Should be called during plugin shutdown.