Files
fil/docs/snippets/elixir/plugins/plugin_logging.md
Henrik Jess Nielsen b4c07d3693
All checks were successful
Deploy fil (kreuzberg) / deploy (push) Successful in 49s
Nomad changes
2026-06-01 23:40:55 +02:00

28 lines
1.1 KiB
Markdown

<!-- snippet:skip reason="Elixir Rustler NIFs cannot host async Send + Sync + 'static Rust trait objects via callbacks; the BEAM actor-model boundary requires plugin work to live in the Rust core. The alef-generated Elixir trait_call macro additionally has a backslash/encoding bug (separate alef-codegen ticket). Custom plugins must be implemented in Rust." -->
Plugin logging is not directly available in the Elixir binding. Logging must be implemented in the Rust plugin code itself using the `tracing` crate.
To add logging to a Rust plugin:
```rust
use tracing::{debug, info, warn};
#[async_trait]
impl DocumentExtractor for MyExtractor {
async fn extract_bytes(
&self,
content: &[u8],
mime_type: &str,
_config: &ExtractionConfig,
) -> Result<ExtractionResult> {
debug!("Starting extraction for {}", mime_type);
// Extraction logic...
info!("Extraction completed for {}", mime_type);
Ok(result)
}
}
```
The logs will be captured by Kreuzberg's tracing infrastructure and can be monitored from Elixir through structured logging in the output.