idstools.rulecat.loghandler module

class idstools.rulecat.loghandler.SuriColourLogHandler(stream=None)[source]

Bases: logging.StreamHandler

An alternative stream log handler that logs with Suricata inspired log colours.

BLUE = '\x1b[34m'
GREEN = '\x1b[32m'
ORANGE = '\x1b[38;5;208m'
RED = '\x1b[31m'
REDB = '\x1b[1;31m'
RESET = '\x1b[0m'
YELLOW = '\x1b[33m'
YELLOWB = '\x1b[1;33m'
emit(record)[source]

Emit a record.

If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended to the stream. If the stream has an ‘encoding’ attribute, it is used to determine how to do the output to the stream.

formatTime(record)[source]