From 9d7b31e50280523e216216654197ad21280fdc2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Mon, 24 Apr 2023 14:53:11 +0200 Subject: [PATCH] room: Generate human-readable ID for logs --- src/session/room/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/session/room/mod.rs b/src/session/room/mod.rs index ce836bbf..63f0aa55 100644 --- a/src/session/room/mod.rs +++ b/src/session/room/mod.rs @@ -1595,4 +1595,11 @@ impl Room { pub fn to_pill(&self) -> Pill { Pill::for_room(self) } + + /// Get a human-readable ID for this `Room`. + /// + /// This is to identify the room easily in logs. + pub fn human_readable_id(&self) -> String { + format!("{} ({})", self.display_name(), self.room_id()) + } }