Package-level declarations

Types

Link copied to clipboard

Fans each record out to several sinks, in order.

Link copied to clipboard
class ConsoleSink(formatter: LogFormatter = LogFormatter.Default) : LogSink

Prints each record as one line on standard output: stdout on JVM and native, console.log on JS.

Link copied to clipboard

The global logging configuration.

Link copied to clipboard
class LogConfig

What gets logged and where it goes. Immutable: change it by building a new one, usually through KcoapLogging.configure.

Link copied to clipboard
fun interface LogFormatter

Turns a record into one line of text.

Link copied to clipboard
class Logger

Logs for one tag. Obtain one from a LoggerFactory, or from KcoapLogging.logger for the global configuration.

Link copied to clipboard
class LoggerFactory(configSource: () -> LogConfig)

Creates Loggers that read their configuration from one place.

Link copied to clipboard

Severity of a log record, from the most verbose to the most severe.

Link copied to clipboard
class LogRecord(val timestamp: Instant, val level: LogLevel, val tag: String, val message: String, val fields: Map<String, String> = emptyMap(), val error: Throwable? = null)

One log event, as handed to every LogSink. Immutable, so sinks may keep it, forward it to another thread, or serialize it.

Link copied to clipboard
fun interface LogSink

Where log records go. Implement it to forward records to your own logging (SLF4J, Logcat, OSLog, crash reporting), or combine the sinks provided here.

Link copied to clipboard
object LogTags

The tags kcoap logs under. Sub-tags inherit levels, so coap covers coap.exchange.

Link copied to clipboard
class RingBufferSink(val capacity: Int) : LogSink

Keeps the last capacity records in memory, so they can be gathered on demand: attached to a bug report, shown in a debug screen, or returned by a diagnostics endpoint.

Functions

Link copied to clipboard

Passes on only records at level or above, for example to send warnings to a crash reporter.

Link copied to clipboard
operator fun LogSink.plus(other: LogSink): LogSink

Sends each record to this sink and to other.