fruently 0.8.0

A yet another Fluentd logger for Rust.
Documentation

Fruently

Build Status Build status

Documentation

A yet another Fluentd logger for Rust.

Note

If you use this library in Windows, please install Visual Studio 2015 and rust compiler which is targeted for MSVC API and its package manager, which is called cargo via rustup.rs.

And then, follow the below usage instructions.

Usage

Add this to your Cargo.toml:

[dependencies]
fruently = "~0.8.0"

and this to your crate root:

extern crate fruently;

Complete examples

Forwarding with JSON

extern crate fruently;
use fruently::fluent::Fluent;
use std::collections::HashMap;
use fruently::forwardable::JsonForwardable;

fn main() {
    let mut obj: HashMap<String, String> = HashMap::new();
    obj.insert("name".to_string(), "fruently".to_string());
    let fruently = Fluent::new("127.0.0.1:24224", "test");
    match fruently.post(&obj) {
        Err(e) => println!("{:?}", e),
        Ok(_) => return,
    }
}

Forwarding with msgpack

extern crate fruently;
use fruently::fluent::Fluent;
use std::collections::HashMap;
use fruently::forwardable::MsgpackForwardable;

fn main() {
    let mut obj: HashMap<String, String> = HashMap::new();
    obj.insert("name".to_string(), "fruently".to_string());
    let fruently = Fluent::new("127.0.0.1:24224", "test");
    match fruently.post(&obj) {
        Err(e) => println!("{:?}", e),
        Ok(_) => return,
    }
}

Forwarding asynchronously

Fruently does not have asynchronous API because Rust has std::thread::spawn function to make asynchronous API from synchronous one.

If you want to send records into Fluentd asynchronously, please consider using std::thread::spawn like: asynchronous example.

LICENSE

MIT.