A client library for communicating with LogDNA's Ingest API
This crate heavily relies on Hyper and Tokio for it's operation. It is strongly recommend to read their respective docs for advanced usage of this crate.
Overview
The general flow is quite simple, first create a new client with Client::builder.
Then call Client::send as many times a you would like.
Example
You first need a Tokio Runtume
# use Runtime;
let mut rt = new.expect;
The client requires a request template to generate new requests from
# use Params;
# use RequestTemplate;
# use env;
let params = builder
.hostname
.ip
.tags
.build
.expect;
let template = builder
.host
.params
.api_key
.build
.expect;
Now you have everything to create a client
# use Client;
let client = new;
To use a client, we need to call Client::send
Client::send requires an IngestBody, so let's create one
# use ;
// Lets build a line, note that only line is required
let labels = new
.add
.add;
let line1 = builder
.line
.app
.level
.labels
.build
.expect;
let line2 = builder
.line
.app
.level
.build
.expect;
let body = new;
Now we just have to send the body using an the client you created above
# use IngestBody;
let response = client.send;
The response needs to be spawned on the runtime you created earlier
If the reponse is not polled (spawned on a runtime) nothing will happen
# use Response;
assert_eq!