TelekLogger

interface TelekLogger

telek's own logging seam: println/java.util.logging are not acceptable in a library, since the consumer can neither redirect nor silence them. Pass an implementation that forwards to whatever the consumer already uses (slf4j, kotlin-logging, ...) — telek has no opinion on the concrete backend and does not depend on one.

The default is NoOp, so a bot that configures nothing hears none of the six things telek has decided are worth saying. That is a deliberate stance — a library that writes to stderr has made a decision belonging to the program that embeds it — but it is only defensible if the cost is stated, so here is the whole list and what is lost with it.

Two are only here. Nothing else in the API reports them, and with NoOp they are gone:

What happenedWhereLooks like, unheard
An input was dropped because that conversation's inbox was fullChatWorkersA user's message vanished
A stored state file could not be readFileStateStorage.loadnull — indistinguishable from a first-time user

Four are also reachable another way, so silence costs the message rather than the fact:

What happenedAlso reaches
An EffectHandler threwTelekInterceptor.onError, as an EffectFailed
An AsyncEffectHandler threwTelekInterceptor.onError — it is rethrown to Telek, which reports it
A stored state file could not be writtenFileStateStorage.save throws
A per-user key found the chat-keyed file it supersedesNothing — but the key is new, so nothing is lost either, only unexplained

The first table is the one to read before deciding NoOp is fine for your bot.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open fun debug(message: String)
Link copied to clipboard
open fun error(message: String, error: Throwable? = null)
Link copied to clipboard
abstract fun log(level: TelekLogLevel, message: String, error: Throwable? = null)
Link copied to clipboard
open fun warn(message: String, error: Throwable? = null)