"""wxPython logging.
Defines a root logger which can be imported by scripts using this package, and
configurations for color stdout formatting. Currently, modules request loggers
locally, but they could import the root logger directly.
"""
import logging
import os
import sys
import wx
import wx.lib.newevent
import colorama
from colorama import Fore as FG, Back as BG, Style as ST
colorama.init()
# -----------------------------------------------------------------------------
# Colorama formatter
# Formatters
color_formatter_verbose = ColoredFormatter(
fmt=(
FG.LIGHTBLACK_EX + '%(asctime)s ' + ST.RESET_ALL +
FG.WHITE + '%(name)s ' + ST.RESET_ALL +
FG.LIGHTBLUE_EX + '%(module)s.py:%(lineno)d ' + ST.RESET_ALL +
'%(levelname)s ' +
FG.WHITE + '%(message)s' + ST.RESET_ALL
),
datefmt='%Y-%m-%d %H:%M:%S')
color_formatter = ColoredFormatter(
fmt=(
FG.LIGHTBLACK_EX + '%(asctime)s ' + ST.RESET_ALL +
'%(levelname)s ' +
FG.WHITE + '%(message)s' + ST.RESET_ALL
),
datefmt='%Y-%m-%d %H:%M:%S')
white_formatter_verbose = logging.Formatter(
fmt='%(asctime)s %(name)s %(module)s.py:%(lineno)d [%(levelname)s] %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
white_formatter = logging.Formatter(
fmt='%(asctime)s [%(levelname)s] %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')