feat: log received node events

Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
Lars Wirzenius
2024-10-08 14:21:54 +03:00
parent 21b14a2328
commit d2324ca652
2 changed files with 13 additions and 2 deletions
+9 -1
View File
@@ -4,7 +4,7 @@
use std::sync::Once;
use std::{path::Path, sync::Mutex, time::Duration};
use radicle::{git::raw::Oid, identity::RepoId};
use radicle::{git::raw::Oid, identity::RepoId, node::Event};
use slog::{debug, error, info, o, warn, Drain};
use slog_scope::GlobalLoggerGuard;
@@ -79,6 +79,14 @@ pub fn node_event_source_created(source: &NodeEventSource) {
);
}
pub fn node_event_source_got_event(event: &Event) {
info!(
slog_scope::logger(),
"node event source received event";
"node_event" => format!("{event:#?}")
);
}
pub fn loaded_config(config: &Config) {
debug!(slog_scope::logger(), "loaded configuration {config:#?}");
}
+4 -1
View File
@@ -45,7 +45,10 @@ impl NodeEventSource {
pub fn node_event(&mut self) -> Result<Option<Event>, NodeEventError> {
if let Some(event) = self.events.next() {
match event {
Ok(event) => Ok(Some(event)),
Ok(event) => {
logger::node_event_source_got_event(&event);
Ok(Some(event))
}
Err(radicle::node::Error::Io(err))
if err.kind() == std::io::ErrorKind::ConnectionReset =>
{