OptionalcloseCloses the sink and releases its resources. Called when the logger is closing. Optional - implement this if your sink needs cleanup (e.g. closing file handles, database connections).
OptionalflushFlushes any buffered data to the underlying destination. Called by Logger.flush; implement it when your sink buffers writes (e.g. a file writer) and durability on flush matters.
Logs a message with the sink's implementation.
The log level at which the message should be logged.
The epoch timestamp (ms) at which the message was logged.
The object to log.
A promise when the sink is asynchronous; it is awaited by Logger.flush.
A logging destination.
This is the object a SinkFactory returns. The factory runs inside the logger worker, so the sink closes over its own state (file handles, buffers, …) instead of exposing it. All values the sink needs must be created inside the factory body — it cannot close over module-scoped imports (use dynamic
import()or runtime globals such asBuninstead).