home · contact · privacy
Improve PRIVMSG/NOTICE debugging log readability. master
authorChristian Heller <c.heller@plomlompom.de>
Mon, 22 Sep 2025 07:21:52 +0000 (09:21 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 22 Sep 2025 07:21:52 +0000 (09:21 +0200)
ircplom/client.py
test.txt

index eeb1708b5c79adec4551ca2b5db14e84d0d5a675..ed7ffe134a7257bd2af728ab9d13955e14f60543 100644 (file)
@@ -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
index 46cced7e2894116d6e42b9c1f8b7bf14fca2692f..04ebd3a2efcc6a84d068784212b2f42b51bc0af2 100644 (file)
--- a/test.txt
+++ b/test.txt
 
 # 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 :?
 
 
 # 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
 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
 
 # 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