summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-12-19 22:52:15 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-12-19 22:52:15 +0100
commitbb978abee6022a5b65189d4cddfdd1acb3c30b79 (patch)
tree7e5ea5eb81d91f6392602a7c9d957cefa01c1dc4
parent904e7a053c519d6d93ba802b7931da3fbc97cc19 (diff)
Store String in log, so we can write normal logging stuff to that log, too
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--gui/src/app/mod.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/gui/src/app/mod.rs b/gui/src/app/mod.rs
index ba0675b..4426e2d 100644
--- a/gui/src/app/mod.rs
+++ b/gui/src/app/mod.rs
@@ -36,7 +36,7 @@ enum Distrox {
timeline: Timeline,
log_visible: bool,
- log: std::collections::VecDeque<distrox_lib::gossip::GossipMessage>,
+ log: std::collections::VecDeque<String>,
},
FailedToStart,
}
@@ -163,7 +163,14 @@ impl Application for Distrox {
}
Message::GossipHandled(msg) => {
+ use distrox_lib::gossip::GossipMessage;
+
log::trace!("Gossip handled, adding to log: {:?}", msg);
+ let msg = match msg {
+ GossipMessage::CurrentProfileState { peer_id, cid } => {
+ format!("Peer {:?} is at {:?}", peer_id, cid)
+ }
+ };
log.push_back(msg);
while log.len() > 1000 {
let _ = log.pop_front();
@@ -243,14 +250,6 @@ impl Application for Distrox {
if *log_visible {
let log = Column::with_children({
log.iter()
- .map(|msg| {
- use distrox_lib::gossip::GossipMessage;
- match msg {
- GossipMessage::CurrentProfileState { peer_id, cid } => {
- format!("Peer {:?} is at {:?}", peer_id, cid)
- }
- }
- })
.map(iced::Text::new)
.map(|txt| txt.size(8))
.map(iced::Element::from)