2 releases
0.1.1 | Sep 23, 2022 |
---|---|
0.1.0 | Sep 23, 2022 |
#43 in #fluent
9KB
170 lines
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);
Dependencies
~0–1.9MB
~36K SLoC