Skip to content

Commit

Permalink
[GSB,mkt] log level decrease (#768)
Browse files Browse the repository at this point in the history
* [GSB,mkt] log level decrease

* apply review suggestion from @mfranciszkiewicz
  • Loading branch information
tworec authored Nov 9, 2020
1 parent 276c67f commit 7f8eb0c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion core/market/src/protocol/negotiation/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl NegotiationApi {
caller: String,
msg: ProposalReceived,
) -> Result<(), CounterProposalError> {
log::debug!(
log::trace!(
"Negotiation API: Received proposal [{}] from [{}].",
&msg.proposal.proposal_id,
&caller
Expand Down
2 changes: 1 addition & 1 deletion core/market/src/protocol/negotiation/requestor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl NegotiationApi {
caller: String,
msg: ProposalReceived,
) -> Result<(), CounterProposalError> {
log::debug!(
log::trace!(
"Negotiation API: Received proposal [{}] from [{}].",
&msg.proposal.proposal_id,
&caller
Expand Down
8 changes: 4 additions & 4 deletions core/net/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub async fn bind_remote(default_node_id: NodeId, nodes: Vec<NodeId>) -> std::io
if let Some(prefix) = prefix {
// replaces /net/<dest_node_id>/test/1 --> /public/test/1
let local_addr: String = addr.replacen(prefix, net::PUBLIC_PREFIX, 1);
log::debug!(
log::trace!(
"Incoming msg from = {}, to = {}, fwd to local addr = {}, request_id: {}",
caller,
addr,
Expand Down Expand Up @@ -90,7 +90,7 @@ pub async fn bind_remote(default_node_id: NodeId, nodes: Vec<NodeId>) -> std::io
// bind /net on my local bus and forward all calls to remote bus under /net
{
let log_message = |caller: &str, addr: &str, label: &str| {
log::debug!(
log::trace!(
"Sending {} message to hub. Called by: {}, addr: {}.",
label,
net_service(&caller),
Expand Down Expand Up @@ -133,7 +133,7 @@ pub async fn bind_remote(default_node_id: NodeId, nodes: Vec<NodeId>) -> std::io
Ok(v) => v,
Err(e) => return future::err(Error::GsbBadRequest(e.to_string())).left_future(),
};
log::debug!("{} is calling (rpc) {}", from_node, to_addr);
log::trace!("{} is calling (rpc) {}", from_node, to_addr);
if !nodes_rpc.contains(&from_node) {
return future::err(Error::GsbBadRequest(format!(
"caller: {:?} is not on src list: {:?}",
Expand All @@ -160,7 +160,7 @@ pub async fn bind_remote(default_node_id: NodeId, nodes: Vec<NodeId>) -> std::io
.left_stream();
}
};
log::debug!("{} is calling (stream) {}", from_node, to_addr);
log::trace!("{} is calling (stream) {}", from_node, to_addr);
if !nodes_stream.contains(&from_node) {
let err = Error::GsbBadRequest(format!(
"caller: {:?} is not on src list: {:?}",
Expand Down
36 changes: 18 additions & 18 deletions service-bus/router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ where
}

pub fn connect<B: Sink<M, Error = E> + Send + 'static>(&mut self, addr: A, sink: B) {
log::debug!("Accepted connection from {}", addr);
log::trace!("Accepted connection from {}", addr);
self.dispatcher.register(addr.clone(), sink).unwrap();
self.last_seen.insert(addr, Utc::now().naive_utc());
}

pub fn disconnect(&mut self, addr: &A) {
log::debug!("Closing connection with {}", addr);
log::trace!("Closing connection with {}", addr);
self.last_seen.remove(addr);

// IDs of all endpoints registered by this server
Expand All @@ -101,7 +101,7 @@ where
.unwrap_or(HashSet::new());

for service_id in service_ids.iter() {
log::debug!("unregistering service: {}", service_id);
log::trace!("unregistering service: {}", service_id);
self.registered_endpoints.remove(service_id);
}

Expand Down Expand Up @@ -192,6 +192,7 @@ where
.entry(addr.clone())
.or_insert_with(|| HashSet::new())
.insert(msg.service_id.clone());
log::trace!("Service successfully registered");
RegisterReply {
code: RegisterReplyCode::RegisteredOk as i32,
message: format!("Service ID '{}' successfully registered", msg.service_id),
Expand All @@ -204,19 +205,16 @@ where
}

fn unregister_endpoint(&mut self, addr: &A, msg: UnregisterRequest) -> anyhow::Result<()> {
log::debug!(
"Received UnregisterRequest from {}. service_id = {}",
addr,
&msg.service_id
);
log::trace!("{} is unregistering endpoint {}", addr, &msg.service_id);

let msg = match self.registered_endpoints.entry(msg.service_id.clone()) {
Entry::Occupied(entry) if entry.get() == addr => {
entry.remove();
self.reversed_endpoints
.get_mut(addr)
.ok_or(anyhow::anyhow!("Address not found: {}", addr))?
.remove(&msg.service_id);
log::debug!("Service successfully unregistered");
log::trace!("Service successfully unregistered");
UnregisterReply {
code: UnregisterReplyCode::UnregisteredOk as i32,
}
Expand All @@ -232,10 +230,10 @@ where
}

fn call(&mut self, caller_addr: &A, msg: CallRequest) -> anyhow::Result<()> {
log::debug!(
"Received CallRequest from {}. caller = {}, address = {}, request_id = {}",
caller_addr,
log::trace!(
"{} ({}) is calling {}, request_id = {}",
&msg.caller,
caller_addr,
&msg.address,
&msg.request_id
);
Expand Down Expand Up @@ -265,7 +263,7 @@ where
};
match server_addr {
Ok(server_addr) => {
log::debug!("Forwarding CallRequest to {}", server_addr);
log::trace!("Forwarding CallRequest to {}", server_addr);
self.send_message(&server_addr, msg)
}
Err(err) => {
Expand All @@ -282,7 +280,7 @@ where
}

fn reply(&mut self, server_addr: &A, msg: CallReply) -> anyhow::Result<()> {
log::debug!(
log::trace!(
"Received CallReply from {} request_id = {}",
server_addr,
&msg.request_id
Expand Down Expand Up @@ -318,7 +316,7 @@ where
}

fn subscribe(&mut self, addr: &A, msg: SubscribeRequest) -> anyhow::Result<()> {
log::debug!(
log::trace!(
"Received SubscribeRequest from {} topic = {}",
addr,
&msg.topic
Expand All @@ -339,6 +337,7 @@ where
.entry(addr.clone())
.or_insert_with(|| HashSet::new())
.insert(msg.topic);
log::trace!("Successfully subscribed");
SubscribeReply {
code: SubscribeReplyCode::SubscribedOk as i32,
message: "Successfully subscribed to topic".to_string(),
Expand All @@ -355,7 +354,7 @@ where
}

fn unsubscribe(&mut self, addr: &A, msg: UnsubscribeRequest) -> anyhow::Result<()> {
log::debug!(
log::trace!(
"Received UnsubscribeRequest from {} topic = {}",
addr,
&msg.topic
Expand All @@ -370,7 +369,7 @@ where
.get_mut(addr)
.ok_or(anyhow::anyhow!("Address not found: {}", addr))?
.remove(&msg.topic);
log::debug!("Successfully unsubscribed");
log::trace!("Successfully unsubscribed");
UnsubscribeReply {
code: UnsubscribeReplyCode::UnsubscribedOk as i32,
}
Expand All @@ -384,7 +383,7 @@ where
}

fn broadcast(&mut self, addr: &A, msg: BroadcastRequest) -> anyhow::Result<()> {
log::debug!(
log::trace!(
"Received BroadcastRequest from {} topic = {} caller = {}",
addr,
&msg.topic,
Expand All @@ -396,6 +395,7 @@ where
message: "OK".to_string(),
}
} else {
log::warn!("Invalid topic ID: {} for broadcast", msg.topic);
BroadcastReply {
code: BroadcastReplyCode::BroadcastBadRequest as i32,
message: format!("Invalid topic ID: {}", msg.topic),
Expand Down

0 comments on commit 7f8eb0c

Please sign in to comment.