mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
dnetview: add line numbers to msg log
This commit is contained in:
@@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
use darkfi::util::NanoTimestamp;
|
||||
|
||||
// Mutex<FxHashMap<ConnectInfo.id, Vec<(NanoTimestamp, send, recv)>>>
|
||||
type MsgLogMutex = Mutex<FxHashMap<String, Vec<(NanoTimestamp, String, String)>>>;
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
|
||||
@@ -277,14 +277,16 @@ impl View {
|
||||
let log = self.msg_log.get(&connect.id);
|
||||
match log {
|
||||
Some(values) => {
|
||||
for (t, k, v) in values {
|
||||
for (i, (t, k, v)) in values.into_iter().enumerate() {
|
||||
lines.push(Spans::from(match k.as_str() {
|
||||
"send" => {
|
||||
Span::styled(format!("{} S: {}", t, v), style)
|
||||
}
|
||||
"recv" => {
|
||||
Span::styled(format!("{} R: {}", t, v), style)
|
||||
}
|
||||
"send" => Span::styled(
|
||||
format!("{} {} S: {}", i, t, v),
|
||||
style,
|
||||
),
|
||||
"recv" => Span::styled(
|
||||
format!("{} {} R: {}", i, t, v),
|
||||
style,
|
||||
),
|
||||
data => {
|
||||
return Err(DnetViewError::UnexpectedData(data.to_string()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user