home · contact · privacy
Remove LogScope.RAW.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 24 Sep 2025 03:32:56 +0000 (05:32 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 24 Sep 2025 03:32:56 +0000 (05:32 +0200)
ircplom/client_tui.py

index cd3e96479be943d804c7ca655e4ae8000d83075c..9fe8ca6fc9386641c69c2e25eee4be0db66cdcd4 100644 (file)
@@ -29,7 +29,6 @@ class _LogScope(Enum):
     'Where log messages should go.'
     ALL = auto()
     DEBUG = auto()
-    RAW = auto()
     CHAT = auto()
     USER = auto()
     USER_NO_CHANNELS = auto()
@@ -40,8 +39,7 @@ class _ClientWindow(Window, ClientQueueMixin):
     def __init__(self, scope: _LogScope, **kwargs) -> None:
         self.scope = scope
         super().__init__(**kwargs)
-        self._title = f'{self.client_id} '\
-            + f':{"DEBUG" if self.scope == _LogScope.DEBUG else "RAW"}'
+        self._title = f'{self.client_id} :DEBUG'
 
     def _send_msg(self, verb: str, params: tuple[str, ...]) -> None:
         self._client_trigger('send_w_params_tuple', verb=verb, params=params)
@@ -340,8 +338,6 @@ class _ClientWindowsManager:
         if scope == _LogScope.ALL:
             ret = [w for w in self.windows
                    if w not in self.windows_for(_LogScope.DEBUG)]
-        elif scope == _LogScope.RAW:
-            ret = self.windows_for(_LogScope.DEBUG)
         elif scope == _LogScope.DEBUG:
             ret = [w for w in self.windows if w.scope == _LogScope.DEBUG]
         elif scope == _LogScope.CHAT:
@@ -418,7 +414,8 @@ class ClientTui(BaseTui):
 
     def log(self, msg: str, **kwargs) -> tuple[tuple[int, ...], str]:
         win_ids, logged_msg = super().log(msg, **kwargs)
-        if kwargs.get('scope', None) == _LogScope.RAW:
+        if kwargs.get('scope', None) == _LogScope.DEBUG\
+                and kwargs['prefix'] in {_LOG_PREFIX_IN, _LOG_PREFIX_OUT}:
             with open(f'{kwargs["client_id"]}.log', 'a', encoding='utf8') as f:
                 f.write(f'{logged_msg}\n')
         return win_ids, logged_msg
@@ -510,11 +507,11 @@ class ClientKnowingTui(Client):
 
     def send(self, verb: str, *args) -> IrcMessage:
         msg = super().send(verb, *args)
-        self._log(msg.raw, scope=_LogScope.RAW, out=True)
+        self._log(msg.raw, scope=_LogScope.DEBUG, out=True)
         return msg
 
     def handle_msg(self, msg: IrcMessage) -> None:
-        self._log(msg.raw, scope=_LogScope.RAW, out=False)
+        self._log(msg.raw, scope=_LogScope.DEBUG, out=False)
         try:
             super().handle_msg(msg)
         except ImplementationFail as e: