Plugin
Plugins are a powerful way to extend Colotok's functionality beyond its core features. This page explains what plugins are, how they work, and how they can enhance your logging experience.
What are Colotok Plugins?
In Colotok, plugins are extensions that add new capabilities to the logging system. They can:
Add support for new logging destinations (like cloud services or databases)
Provide integration with other libraries and frameworks
Add new formatting options
Enhance existing functionality with additional features
Plugins follow a consistent architecture that makes them easy to use and integrate with your application.
Plugin Architecture
Colotok has a flexible plugin architecture built around core provider contracts:
Provider abstract class and IProvider interface: The foundation for destinations that receive log records
ProviderConfig Interface: Defines configuration options for providers
AsyncProvider abstract class: Extends
Providerwith a channel-backed, batched publishing lifecycle
This architecture allows plugins to be:
Modular: Each plugin focuses on a specific functionality
Configurable: Plugins can be customized to meet your specific needs
Composable: Multiple plugins can be used together in the same application
Benefits of Using Plugins
Using Colotok plugins offers several advantages:
Extended Functionality: Access features beyond the core library
Simplified Integration: Easily connect with other systems and services
Consistent API: Use the same logging API regardless of the destination
Platform Flexibility: Some plugins support the Kotlin Multiplatform targets published by Colotok
Customization: Adapt logging behavior to your specific requirements
Types of Plugins
Colotok plugins generally fall into these categories:
1. Integration Plugins
These plugins connect Colotok with external systems:
colotok-cloudwatch: Sends logs to AWS CloudWatch
colotok-loki: Sends logs to Grafana Loki
colotok-slf4j: SLF4J 1.7 binding backed by Colotok
colotok-slf4j2: SLF4J 2.x service provider backed by Colotok
2. Enhancement Plugins
These plugins add new capabilities to Colotok:
colotok-coroutines: Adds suspending logging extensions and the
AsyncProviderbase class for batched delivery
3. Custom Plugins
You can also create your own plugins to:
Send logs to custom destinations
Implement specialized formatting
Add domain-specific logging features
Getting Started with Plugins
To use a plugin, you need to:
Add the plugin dependency to your project
Configure the plugin according to your needs
Add the plugin's provider to a
ColotokLoggerContextwhen the plugin supplies one
For example, to use the colotok-coroutines plugin:
Learn More
For more information about Colotok plugins, check these resources:
Official Plugins: Detailed information about the plugins provided by Colotok
Creating Plugins: Guide to creating your own custom plugins