Skip to main content
Extensions have access to a set of utility services and helper functions for logging, resource access, UI effects, and common Kotlin patterns.

Logger

Klyx provides a full logging system with log levels, contextual information, and structured output. Access it through the plugin’s logger or the global Logger.

Log levels

LogContext

All logging calls accept an optional LogContext that provides tagged and tagged-with-plugin metadata:
LogContext is a marker interface. KlyxPlugin implements LogContext, so logging inside a plugin method automatically uses the plugin’s name as the tag and its ID as the source. Use NoLogContext for code not associated with a plugin.

Logger extensions

The Logger service is accessed through the plugin’s dependency injection. Use the plugin() delegate or rememberLogger() in composables:

Structured logging

LogEntry and LogLevel

rememberLogger()

A composable that remembers the Logger from the current LocalApp:

Resources

Plugin access to Android resources is through PluginContext:

Resource access with withResources

The withResources composable wraps content with the plugin’s LocalContext, making resource-backed Compose APIs resolve against the plugin’s own resources:

Context receiver extensions

Extensions provide convenience functions that use Kotlin context receivers. These are available when the plugin instance is in scope.

UI effects

Lifecycle helpers

Plugin context

Toast host state

The Navigator service handles screen navigation:

SpecialScreens

Pre-defined screen IDs:

Example

Klyx extensions

Additional utility extensions available across the codebase:

Human-readable size

File utilities

Uri extensions

String encoding

Collections

Error handling

Slider steps

Terminal utilities

Paths

Example

The following demonstrates common utility patterns in a plugin: