Files
fil/docs/snippets/ruby/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

30 lines
663 B
Markdown

```ruby title="Ruby"
require 'kreuzberg'
require 'logger'
logger = Logger.new($stdout)
class LoggingPostProcessor
def call(result)
puts "Processing: #{result['mime_type']}"
puts "Content: #{result['content'].length} bytes"
result
end
end
class LoggingValidator
def call(result)
puts "Validating: #{result['content'].length} bytes"
raise StandardError, 'Too short' if result['content'].length < 50
end
end
processor = LoggingPostProcessor.new
validator = LoggingValidator.new
Kreuzberg.register_post_processor('logging-proc', processor)
Kreuzberg.register_validator('logging-val', validator)
logger.info('Plugins registered')
```