This commit is contained in:
52
docs/snippets/csharp/plugins/plugin_logging.md
Normal file
52
docs/snippets/csharp/plugins/plugin_logging.md
Normal file
@@ -0,0 +1,52 @@
|
||||
```csharp title="C#"
|
||||
using Kreuzberg;
|
||||
|
||||
var processor = new LoggingPostProcessor();
|
||||
PostProcessorRegistry.Register(processor);
|
||||
|
||||
public class LoggingPostProcessor : IPostProcessor
|
||||
{
|
||||
public string Name => "logging-processor";
|
||||
public string Version => "1.0.0";
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
Console.WriteLine("Logging post-processor initialized");
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
Console.WriteLine("Logging post-processor shut down");
|
||||
}
|
||||
|
||||
public void Process(ExtractionResult result, ExtractionConfig config)
|
||||
{
|
||||
Console.WriteLine($"Processing: {result.MimeType}, Content length: {result.Content.Length}");
|
||||
|
||||
if (string.IsNullOrEmpty(result.Content))
|
||||
{
|
||||
Console.WriteLine("Warning: Extracted content is empty");
|
||||
}
|
||||
}
|
||||
|
||||
public ProcessingStage ProcessingStage()
|
||||
{
|
||||
return ProcessingStage.Early;
|
||||
}
|
||||
|
||||
public bool ShouldProcess(ExtractionResult result, ExtractionConfig config)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public ulong EstimatedDurationMs(ExtractionResult result)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int Priority()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user