flb-plugin - Fluent Bit plugin binding for Rust
struct Hello;
impl flb_plugin::output::Plugin for Hello {
const NAME: &'static CStr = const_cstr!("hello");
const DESCRIPTION: &'static CStr = const_cstr!("hello plugin");
fn new(config: &output::Config) -> Self {
let param = config.get_property(const_cstr!("param"));
println!("[new] param: {:?}", param);
Hello
}
fn flush(&mut self, tag: &str, mut data: &[u8]) -> Result<(), flb_plugin::Error> {
let value = rmpv::decode::read_value_ref(&mut data).unwrap();
println!("[flush] tag: {tag}, data: {:?}", value);
Ok(())
}
fn exit(self) -> Result<(), flb_plugin::Error> {
println!("[exit]");
Ok(())
}
}
flb_plugin::output_plugin_proxy!(Hello);