30 lines
703 B
Rust
30 lines
703 B
Rust
use logtail_poster::*;
|
|
|
|
#[derive(Clone, serde::Serialize)]
|
|
struct Data {
|
|
pub msg: String,
|
|
}
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
let collection = "rebterlai.example.logtail-poster".to_string();
|
|
let cfg = logtail_poster::Config::load(collection.clone()).unwrap();
|
|
let (ing, eg) = Builder::default()
|
|
.collection(collection)
|
|
.private_id(cfg.private_id())
|
|
.user_agent("rebterlai/test".to_string())
|
|
.base_url("http://127.0.0.1:3848".to_string())
|
|
.build()
|
|
.unwrap();
|
|
|
|
ing.send(
|
|
serde_json::to_value(Data {
|
|
msg: "Hello, world!".to_string(),
|
|
})
|
|
.unwrap(),
|
|
)
|
|
.unwrap();
|
|
|
|
eg.post().await.unwrap();
|
|
}
|