# Path: falsy/jlog/filters.py
# class TraceFilter(logging.Filter):
#     def filter(self, record):
#         if 'trace' not in dir(record):
#             record.trace = ''
#         else:
#             record.trace = '\n\t' + record.trace
#         return True
# 
# class HighlightFilter(logging.Filter):
#     def __init__(self, highlights=None):
#         self.highlights = highlights
# 
#     def filter(self, record):
#         record.high = ''
#         if self.highlights is None:
#             return True
#         for e in self.highlights:
#             if e in record.msg:
#                 record.high = '\n\t' + \
#                               magenta() + 'highlight' + rmagenta() + ': ' + \
#                               record.msg.replace(e, cc(e, fore='yellow', back='red'))
#         return True
# 
# Path: falsy/jlog/formatters.py
# class JLogColoredFormatter(logging.Formatter):
#     def __init__(self, fmt=None, datefmt=None, style='%',
#                  log_colors=None, reset=True):
#         if fmt is None:
#             default_formats = {
#                 '%': '%(log_color)s%(levelname)s:%(name)s:%(message)s',
#                 '{': '{log_color}{levelname}:{name}:{message}',
#                 '$': '${log_color}${levelname}:${name}:${message}'
#             }
#             fmt = default_formats[style]
# 
#         super().__init__(fmt, datefmt, style)
#         default_log_colors = {
#             'DEBUG': 'white',
#             'INFO': 'green',
#             'WARNING': 'yellow',
#             'ERROR': 'red',
#             'CRITICAL': 'red',
#         }
# 
#         self.log_colors = (
#             log_colors if log_colors is not None else default_log_colors)
#         self.reset = reset
# 
#     def color(self, log_colors, level_name):
#         return parse_colors(log_colors.get(level_name, ""))
# 
#     def format(self, record):
#         record = ColoredRecord(record)
#         record.log_color = self.color(self.log_colors, record.levelname)
# 
#         message = super().format(record)
# 
#         if self.reset and not message.endswith(codes['reset']):
#             message += codes['reset']
# 
#         return message
# 
# Path: falsy/termcc/termcc.py
# def blue():
#     return fore('blue')
# 
# def yellow():
#     return fore('yellow')
# 
# def cyan():
#     return fore('cyan')
# 
# def red():
#     return fore('red')
# 
# def bold():
#     return style('bold')  #
# 
# def magenta():
#     return fore('magenta')


import logging
import logging.config
import traceback
import collections
import sys
from falsy.jlog.filters import TraceFilter, HighlightFilter
from falsy.jlog.formatters import JLogColoredFormatter
from falsy.termcc.termcc import blue, yellow, cyan, red, bold, magenta
        return self.logger.critical(msg, *args, **kwargs)

    def warning_trace(self, msg, *args, **kwargs):
        self.trace(kwargs)
        return self.logger.critical(msg, *args, **kwargs)

    def critical_trace(self, msg, *args, **kwargs):
        self.trace(kwargs)
        return self.logger.critical(msg, *args, **kwargs)

    def error_trace(self, msg, *args, **kwargs):
        self.trace(kwargs)
        return self.logger.error(msg, *args, **kwargs)

    def trace(self, kwargs):
        exc_type, exc_value, exc_traceback = sys.exc_info()
        stack = traceback.extract_tb(exc_traceback)
        lines = []
        for i, s in enumerate(stack):
            filename = s.filename
            l = len(filename)
            shortfile = kwargs.get('shortfile', 40)
            if l > shortfile:
                filename = filename[filename.find('/', l - shortfile):]
            line = '%-40s:%-4s %s' % (
                blue() + filename, yellow() + str(s.lineno),
                '|' + '-' * (i * 4) + cyan() + s.name + ':' + red() + s.line)
            lines.append(line)
        lines = '\n\t'.join(lines)
        kwargs['extra'] = {

# Path: falsy/jlog/filters.py
# class TraceFilter(logging.Filter):
#     def filter(self, record):
#         if 'trace' not in dir(record):
#             record.trace = ''
#         else:
#             record.trace = '\n\t' + record.trace
#         return True
# 
# class HighlightFilter(logging.Filter):
#     def __init__(self, highlights=None):
#         self.highlights = highlights
# 
#     def filter(self, record):
#         record.high = ''
#         if self.highlights is None:
#             return True
#         for e in self.highlights:
#             if e in record.msg:
#                 record.high = '\n\t' + \
#                               magenta() + 'highlight' + rmagenta() + ': ' + \
#                               record.msg.replace(e, cc(e, fore='yellow', back='red'))
#         return True
# 
# Path: falsy/jlog/formatters.py
# class JLogColoredFormatter(logging.Formatter):
#     def __init__(self, fmt=None, datefmt=None, style='%',
#                  log_colors=None, reset=True):
#         if fmt is None:
#             default_formats = {
#                 '%': '%(log_color)s%(levelname)s:%(name)s:%(message)s',
#                 '{': '{log_color}{levelname}:{name}:{message}',
#                 '$': '${log_color}${levelname}:${name}:${message}'
#             }
#             fmt = default_formats[style]
# 
#         super().__init__(fmt, datefmt, style)
#         default_log_colors = {
#             'DEBUG': 'white',
#             'INFO': 'green',
#             'WARNING': 'yellow',
#             'ERROR': 'red',
#             'CRITICAL': 'red',
#         }
# 
#         self.log_colors = (
#             log_colors if log_colors is not None else default_log_colors)
#         self.reset = reset
# 
#     def color(self, log_colors, level_name):
#         return parse_colors(log_colors.get(level_name, ""))
# 
#     def format(self, record):
#         record = ColoredRecord(record)
#         record.log_color = self.color(self.log_colors, record.levelname)
# 
#         message = super().format(record)
# 
#         if self.reset and not message.endswith(codes['reset']):
#             message += codes['reset']
# 
#         return message
# 
# Path: falsy/termcc/termcc.py
# def blue():
#     return fore('blue')
# 
# def yellow():
#     return fore('yellow')
# 
# def cyan():
#     return fore('cyan')
# 
# def red():
#     return fore('red')
# 
# def bold():
#     return style('bold')  #
# 
# def magenta():
#     return fore('magenta')


# Path: falsy/jlog/jlog.py
import logging
import logging.config
import traceback
import collections
import sys
from falsy.jlog.filters import TraceFilter, HighlightFilter
from falsy.jlog.formatters import JLogColoredFormatter
from falsy.termcc.termcc import blue, yellow, cyan, red, bold, magenta

        return self.logger.critical(msg, *args, **kwargs)

    def warning_trace(self, msg, *args, **kwargs):
        self.trace(kwargs)
        return self.logger.critical(msg, *args, **kwargs)

    def critical_trace(self, msg, *args, **kwargs):
        self.trace(kwargs)
        return self.logger.critical(msg, *args, **kwargs)

    def error_trace(self, msg, *args, **kwargs):
        self.trace(kwargs)
        return self.logger.error(msg, *args, **kwargs)

    def trace(self, kwargs):
        exc_type, exc_value, exc_traceback = sys.exc_info()
        stack = traceback.extract_tb(exc_traceback)
        lines = []
        for i, s in enumerate(stack):
            filename = s.filename
            l = len(filename)
            shortfile = kwargs.get('shortfile', 40)
            if l > shortfile:
                filename = filename[filename.find('/', l - shortfile):]
            line = '%-40s:%-4s %s' % (
                blue() + filename, yellow() + str(s.lineno),
                '|' + '-' * (i * 4) + cyan() + s.name + ':' + red() + s.line)
            lines.append(line)
        lines = '\n\t'.join(lines)
        kwargs['extra'] = {

            'trace': magenta() + str(exc_type) + ' ' + bold() + magenta() + str(exc_value) + '\n\t' + lines}