write

fun <T> write(channel: LogChannel<T>, obj: T)

Writes an object to the specified channel.

If the channel is not yet registered with this writer, it will be automatically added before writing the object. The object is serialized using the channel's schema and written as a message entry to the log file.

Parameters

T

The type of the object being written

channel

The channel to write to

obj

The object to write


fun write(channelName: String, obj: Any)

Writes an object to a channel identified by name.

This method provides a dynamic way to write objects when the channel type is not known at compile time. If a channel with the specified name exists, the object is written to that channel. If no such channel exists, a new channel is created automatically using schema inference from the object's class.

Warning: This method uses type erasure and runtime casting, so type safety is not guaranteed. Use the typed write method when possible.

Parameters

channelName

The name of the channel to write to

obj

The object to write