Skip to content

Commit 6ed9be6

Browse files
committed
some log fixes
1 parent 3fe904d commit 6ed9be6

File tree

6 files changed

+37
-46
lines changed

6 files changed

+37
-46
lines changed

Cargo.lock

Lines changed: 26 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fastbloom-rs = "0.5.9"
4444
ollama-workflows = { git = "https://github.com/andthattoo/ollama-workflows", rev = "25467d2" }
4545

4646
# peer-to-peer
47-
libp2p = { git = "https://github.com/anilaltuner/rust-libp2p.git", rev = "c5cefa1", features = [
47+
libp2p = { git = "https://github.com/anilaltuner/rust-libp2p.git", rev = "be2ed55", features = [
4848
"dcutr",
4949
"ping",
5050
"relay",

src/config/models.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl ModelConfig {
9797
match result {
9898
Ok(result) => Some(result),
9999
Err(e) => {
100-
log::error!("Ignoring model: {}", e);
100+
log::debug!("Ignoring model: {}", e);
101101
None
102102
}
103103
}

src/config/openai.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,11 @@ struct OpenAIModelsResponse {
2525
object: String,
2626
}
2727

28-
#[derive(Debug, Clone)]
28+
#[derive(Debug, Clone, Default)]
2929
pub struct OpenAIConfig {
3030
pub(crate) api_key: Option<String>,
3131
}
3232

33-
#[derive(Debug, Clone, Deserialize)]
34-
struct OpenAIError {
35-
message: String,
36-
}
37-
3833
impl OpenAIConfig {
3934
/// Looks at the environment variables for OpenAI API key.
4035
pub fn new() -> Self {

src/node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,11 @@ impl DriaComputeNode {
148148
// };
149149

150150
log::info!(
151-
"Received {} message ({})\nFrom: {}\nOrigin: {:?}",
151+
"Received {} message ({})\nFrom: {}\nOrigin: {}",
152152
topic_str,
153153
message_id,
154154
peer_id,
155-
source_peer_id
155+
source_peer_id.map(|p| p.to_string()).unwrap_or("None".to_string())
156156
);
157157

158158
// ensure that message is from the static RPCs

src/p2p/client.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -311,25 +311,21 @@ impl P2PClient {
311311
.get_closest_peers(random_peer);
312312
self.peer_last_refreshed = tokio::time::Instant::now();
313313

314-
// print number of peers
314+
// get peer count
315315
let gossipsub = &self.swarm.behaviour().gossipsub;
316-
317-
// print peers if the count has changed
318316
let num_peers = gossipsub.all_peers().count();
319317
let num_mesh_peers = gossipsub.all_mesh_peers().count();
318+
319+
// print peers if the count has changed
320320
if num_peers != self.peer_count.0 || num_mesh_peers != self.peer_count.1 {
321321
self.peer_count = (num_peers, num_mesh_peers);
322-
log::info!(
323-
"Peer Count (mesh / all): {} / {}",
324-
num_mesh_peers,
325-
num_peers
326-
);
322+
log::info!("Peer Count (mesh/all): {} / {}", num_mesh_peers, num_peers);
327323
log::debug!(
328324
"All Peers:\n{}",
329325
gossipsub
330326
.all_peers()
331327
.enumerate()
332-
.map(|(i, (p, _))| format!("{:#3}: {}", i, p.to_string()))
328+
.map(|(i, (p, _))| format!("{:#3}: {}", i, p))
333329
.collect::<Vec<_>>()
334330
.join("\n")
335331
);
@@ -338,7 +334,7 @@ impl P2PClient {
338334
gossipsub
339335
.all_mesh_peers()
340336
.enumerate()
341-
.map(|(i, p)| format!("{:#3}: {}", i, p.to_string()))
337+
.map(|(i, p)| format!("{:#3}: {}", i, p))
342338
.collect::<Vec<_>>()
343339
.join("\n")
344340
);

0 commit comments

Comments
 (0)