From b16c06fb59411a55ae94e457a25839cc3577102a Mon Sep 17 00:00:00 2001 From: Christian Heller <c.heller@plomlompom.de> Date: Mon, 22 Sep 2025 09:21:52 +0200 Subject: [PATCH] Improve PRIVMSG/NOTICE debugging log readability. --- ircplom/client.py | 4 ++-- test.txt | 36 ++++++++++++++++++------------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ircplom/client.py b/ircplom/client.py index eeb1708..ed7ffe1 100644 --- a/ircplom/client.py +++ b/ircplom/client.py @@ -282,8 +282,8 @@ class ChatMessage: is_notice: bool = False def __str__(self) -> str: - return f'{"N" if self.is_notice else "P"} '\ - + f'{self.sender} {self.target} :{self.content}' + return f'{"N" if self.is_notice else "P"}|'\ + + f'{self.sender}|{self.target}|{self.content}' def __bool__(self) -> bool: return bool(self.content + self.sender + self.target) | self.is_notice diff --git a/test.txt b/test.txt index 46cced7..04ebd3a 100644 --- a/test.txt +++ b/test.txt @@ -70,17 +70,17 @@ # expect some NOTICE and PING to process/reply during initiation 0:2 < :*.?.net NOTICE * :*** Looking up your ident... -1,2 $ message set to: [N server :*** Looking up your ident...] +1,2 $ message set to: [N| server||*** Looking up your ident...] 3 <<< [ server] *** Looking up your ident... -1,2 $ message set to: [P :] +1,2 $ message set to: [P|||] 0:2 < :*.?.net NOTICE * :*** Looking up your hostname... -1,2 $ message set to: [N server :*** Looking up your hostname...] +1,2 $ message set to: [N| server||*** Looking up your hostname...] 3 <<< [ server] *** Looking up your hostname... -1,2 $ message set to: [P :] +1,2 $ message set to: [P|||] 0:2 < :*.?.net NOTICE * :*** Found your hostname (baz.bar.foo) -1,2 $ message set to: [N server :*** Found your hostname (baz.bar.foo)] +1,2 $ message set to: [N| server||*** Found your hostname (baz.bar.foo)] 3 <<< [ server] *** Found your hostname (baz.bar.foo) -1,2 $ message set to: [P :] +1,2 $ message set to: [P|||] 0:2 < PING :? 2 > PONG :? @@ -160,9 +160,9 @@ # handle bot query NOTICE 0:2 < :SaslServ!SaslServ@services.bar.baz NOTICE foo1 :Last login from ~foobarbaz@foo.bar.baz on Jan 1 22:00:00 2021 +0000. -1,2 $ message set to: [N SaslServ :Last login from ~foobarbaz@foo.bar.baz on Jan 1 22:00:00 2021 +0000.] +1,2 $ message set to: [N|SaslServ||Last login from ~foobarbaz@foo.bar.baz on Jan 1 22:00:00 2021 +0000.] 4 <<< [SaslServ] Last login from ~foobarbaz@foo.bar.baz on Jan 1 22:00:00 2021 +0000. -1,2 $ message set to: [P :] +1,2 $ message set to: [P|||] # check difference in available commands when switching to client window > /join #test @@ -234,9 +234,9 @@ 0:2 < :bar!~bar@bar.bar PRIVMSG #test :hi there 1,2 $ users:1:user set to: [~bar] 1,2 $ users:1:host set to: [bar.bar] -1,2 $ message set to: [P bar #test :hi there] +1,2 $ message set to: [P|bar|#test|hi there] 5 < [bar] hi there -1,2 $ message set to: [P :] +1,2 $ message set to: [P|||] # check _changing_ TOPIC message is communicated to channel window 0:2 < :bar!~bar@bar.bar TOPIC #test :foo bar baz @@ -270,25 +270,25 @@ # handle query window with known user 0:2 < :baz!~baz@baz.baz PRIVMSG foo1 :hi there -1,2 $ message set to: [P baz :hi there] +1,2 $ message set to: [P|baz||hi there] 7 < [baz] hi there -1,2 $ message set to: [P :] +1,2 $ message set to: [P|||] > /privmsg baz hello, how is it going 2 > PRIVMSG baz :hello, how is it going -1,2 $ message set to: [P baz :hello, how is it going] +1,2 $ message set to: [P||baz|hello, how is it going] 7 > [foo1] hello, how is it going -1,2 $ message set to: [P :] +1,2 $ message set to: [P|||] 0:2 < :baz!~baz@baz.baz PRIVMSG foo1 :fine! -1,2 $ message set to: [P baz :fine!] +1,2 $ message set to: [P|baz||fine!] 7 < [baz] fine! -1,2 $ message set to: [P :] +1,2 $ message set to: [P|||] # handle failure to query absent user > /privmsg barbar hello! 2 > PRIVMSG barbar :hello! -1,2 $ message set to: [P barbar :hello!] +1,2 $ message set to: [P||barbar|hello!] 8 > [foo1] hello! -1,2 $ message set to: [P :] +1,2 $ message set to: [P|||] 0:2 < :*.?.net 401 foo1 barbar :No such nick/channel 8 !$ barbar not online -- 2.30.2