Browse Source

Improve log style

NAMES aren't included in the table at all now because they otherwise mess up the :nth-child(even) rule.
master
JustAnotherArchivist 3 years ago
parent
commit
620dd849ab
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      irclog.py

+ 9
- 3
irclog.py View File

@@ -808,11 +808,14 @@ class Storage:
class WebServer:
logger = logging.getLogger('irclog.WebServer')
logStyleTag = '<style>' + " ".join([
'tr:target { background-color: yellow; }',
'table { border-collapse: collapse; }',
'tr:nth-child(even) { background-color: #DDDDDD; }',
'td { padding: 2px; vertical-align: top; }',
'tr:target { background-color: yellow !important; }',
'tr.command_JOIN { color: green; }',
'tr.command_QUIT, tr.command_PART, tr.command_KICK, tr.command_CONNCLOSED { color: red; }',
'tr.command_NAMES { display: none; }',
'tr.command_NICK, tr.command_ACCOUNT, tr.command_MODE, tr.command_TOPIC, tr.command_TOPICWHO, tr.command_WHOX { color: grey; }'
'tr.command_NICK, tr.command_ACCOUNT, tr.command_MODE, tr.command_TOPIC, tr.command_TOPICWHO, tr.command_WHOX { color: grey; }',
'tr.command_NOTICE td:nth-child(3) { font-style: italic; }',
]) + '</style>'

def __init__(self, config):
@@ -935,6 +938,9 @@ class WebServer:
# withDate: whether to include the date with the time of the log line
ret = []
for path, ts, command, content in lines:
if command == 'NAMES':
# Hidden as WHOX provides more information
continue
d = datetime.datetime.utcfromtimestamp(ts).replace(tzinfo = datetime.timezone.utc)
date = f'{d:%Y-%m-%d }' if withDate else ''
lineId = hashlib.md5(f'{ts} {command} {content}'.encode('utf-8')).hexdigest()[:8]


Loading…
Cancel
Save