53 lines
1.1 KiB
Markdown
53 lines
1.1 KiB
Markdown
|
|
```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;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
```
|