from ircplom.irc_conn import IrcMessage
from ircplom.tui_base import (
BaseTui, FormattingString, PromptWidget, TuiEvent, Window,
- CMD_SHORTCUTS, LOG_FMT_ATTRS, LOG_FMT_TAG_ALERT)
+ CMD_SHORTCUTS, LOG_FMT_ATTRS, LOG_FMT_TAG_ALERT, LOG_PREFIX_DEFAULT)
CMD_SHORTCUTS['disconnect'] = 'window.disconnect'
CMD_SHORTCUTS['join'] = 'window.join'
def log(self, msg: FormattingString) -> None:
super().log(msg)
- if self._path_logs is None:
- return
+ if self._path_logs is None\
+ or msg.stripped().startswith(LOG_PREFIX_DEFAULT): # ignore TUI
+ return # chatter
def escaped(word: str) -> str:
ret = ''
# ourselves
from ircplom.events import AffectiveEvent, Loop, QueueMixin, QuitEvent
-_LOG_PREFIX_DEFAULT = '#'
+LOG_PREFIX_DEFAULT = '#'
LOG_FMT_SEP = ' '
LOG_FMT_TAG_ALERT = 'alert'
LOG_FMT_ATTRS: dict[str, tuple[str, ...]] = {
LOG_FMT_TAG_ALERT: ('bold', 'bright_red'),
- _LOG_PREFIX_DEFAULT: ('bright_cyan',),
+ LOG_PREFIX_DEFAULT: ('bright_cyan',),
}
_WRAP_INDENT = 2
if isinstance(msg, str):
msg = FormattingString(msg)
if prefix_char is None:
- prefix_char = _LOG_PREFIX_DEFAULT
+ prefix_char = LOG_PREFIX_DEFAULT
now = str(datetime.now())
today, time = now[:10], now[11:19]
msg = FormattingString(f'{prefix_char}{LOG_FMT_SEP}{time} ') + msg