JsonLogHandler
classin packageklyn.logging.handler
public final class JsonLogHandler extends AbstractLogHandler implements AutoClosable:
└ JsonLogHandler
All Implemented Interfaces: AutoClosable

Appends one JSON object per line to a UTF-8 JSONL file.

Example
import klyn.logging.handler

handler = JsonLogHandler("application.jsonl")
Inherited Properties
propertyInherited Properties from AbstractLogHandler: minimumLevel
Constructors
Modifier and Type Member Description
public JsonLogHandler
JsonLogHandler(path as String, minimumLevel as LogLevel = LogLevel.TRACE, append as Boolean = true):
Creates a JSON-lines handler.
Methods
Modifier and Type Member Description
public override close
close() as Void:
Closes the JSONL file.
public override flush
flush() as Void:
Flushes buffered JSON lines to the file.
public override handle
handle(event as LogEvent) as Void:
Writes one JSON object atomically.
Inherited Methods
methodInherited Methods from AbstractLogHandler: accepts, close, flush, handle
methodInherited Methods from AutoClosable: close
methodInherited Methods from LogHandler: accepts, flush, handle