flb-plugin

Crates.ioflb-plugin
lib.rsflb-plugin
version0.1.1
sourcesrc
created_at2022-09-23 18:34:18.862938
updated_at2022-09-23 18:38:05.929512
descriptionFluent Bit plugin binding for Rust
homepage
repository
max_upload_size
id672642
size8,637
KOBA789 (KOBA789)

documentation

README

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);
Commit count: 0

cargo fmt