Browse Source

darkfid: Improve noisy logging

x 8 tháng trước cách đây
mục cha
commit
40ff64b3fc
2 tập tin đã thay đổi với 9 bổ sung10 xóa
  1. 6 8
      bin/darkfid/src/rpc_xmr.rs
  2. 3 2
      src/rpc/server.rs

+ 6 - 8
bin/darkfid/src/rpc_xmr.rs

@@ -151,12 +151,6 @@ impl DarkfiNode {
         };
         let prev_id = monero::Hash::from_slice(&prev_id);
 
-        info!(
-            target: "darkfid::rpc_xmr::xmr_merge_mining_get_aux_block",
-            "[RPC-XMR] Got blocktemplate request: address={}, aux_hash={}, height={}, prev_id={}",
-            address, aux_hash, height, prev_id,
-        );
-
         // Method params format is correct. Let's check if we provided this
         // mining job already. If so, we can just return an empty response.
         // We'll also obtain a lock here to avoid getting polled multiple
@@ -167,6 +161,12 @@ impl DarkfiNode {
             return JsonResponse::new(JsonValue::from(HashMap::new()), id).into()
         }
 
+        info!(
+            target: "darkfid::rpc_xmr::xmr_merge_mining_get_aux_block",
+            "[RPC-XMR] Got blocktemplate request: address={}, aux_hash={}, height={}, prev_id={}",
+            address, aux_hash, height, prev_id,
+        );
+
         // If it's a new job, clear the previous one(s).
         mm_blocktemplates.clear();
 
@@ -234,8 +234,6 @@ impl DarkfiNode {
             ("aux_hash".to_string(), JsonValue::from(blockhash.as_string())),
         ]));
 
-        info!("<-- {}", response.stringify().unwrap());
-
         JsonResponse::new(response, id).into()
     }
 

+ 3 - 2
src/rpc/server.rs

@@ -38,6 +38,7 @@ use super::{
 use crate::{
     net::transport::{Listener, PtListener, PtStream},
     system::{StoppableTask, StoppableTaskPtr},
+    util::logger::verbose,
     Error, Result,
 };
 
@@ -367,7 +368,7 @@ async fn run_accept_loop<'a, T: 'a>(
         match listener.next().await {
             Ok((stream, url)) => {
                 let rh_ = rh.clone();
-                info!(target: "rpc::server", "[RPC] Server accepted conn from {url}");
+                verbose!(target: "rpc::server", "[RPC] Server accepted conn from {url}");
 
                 let (reader, writer) = smol::io::split(stream);
                 let reader = Arc::new(Mutex::new(BufReader::new(reader)));
@@ -387,7 +388,7 @@ async fn run_accept_loop<'a, T: 'a>(
                         ex_,
                     ),
                     |_| async move {
-                        info!(target: "rpc::server", "[RPC] Closed conn from {url}");
+                        verbose!(target: "rpc::server", "[RPC] Closed conn from {url}");
                         rh_.clone().unmark_connection(task_.clone()).await;
                     },
                     Error::ChannelStopped,