Skip to content

Commit

Permalink
better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
SebRollen committed Jun 16, 2021
1 parent ed333f6 commit 36cd8fd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polygon-data-relay"
version = "1.2.5"
version = "1.2.6"
authors = ["Sebastian Rollen <[email protected]>"]
edition = "2018"

Expand Down
10 changes: 5 additions & 5 deletions src/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub async fn run(
loop {
let msg = rx.recv().expect("Failed to receive message");
let msg_str = serde_json::to_string(&msg).expect("Failed to serialize command");
info!("Control message received: {}", &msg_str);
info!(%msg_str);
sink.send(msg_str)
.await
.map_err(|_| anyhow!("Failed to send message to Sink"))
Expand All @@ -47,23 +47,23 @@ pub async fn run(
let payload = serde_json::to_string(&polygon_message);
match payload {
Ok(payload) => {
debug!(?polygon_message, ?key, ?topic);
debug!(%payload, %key, %topic);
let res = producer
.send(
FutureRecord::to(topic).key(key).payload(&payload),
Duration::from_secs(0),
)
.await;
if let Err((e, msg)) = res {
if let Err((e, _)) = res {
let e = e.into();
sentry_anyhow::capture_anyhow(&e);
error!(?msg, %e)
error!(%e, %payload)
}
}
Err(e) => {
let e = e.into();
sentry_anyhow::capture_anyhow(&e);
error!(%e, ?polygon_message)
error!(%e)
}
}
}
Expand Down

0 comments on commit 36cd8fd

Please sign in to comment.