# Path: kvarq/log.py
# class ColoredFormatter(logging.Formatter):
#     def format(self, record):
# def color_wrap(handler, emit_bak):
#     def emit(record):
# def set_debug():
# def set_info():
# def set_warning():
# def appendlog(fname):
# def tic(name):
# def toc(name):
# def tictoc(name):
#     def decorator(f):
#         def wrapper(*args, **kwargs):
# def format_traceback(exc_info):


import logging
import functools, pdb, sys
from kvarq.log import lo
        logging.Handler.__init__(self, logging.DEBUG)
        self.needle = needle
        self.needle_level = needle_level
        self.found = False

    def handle(self, record):
        if self.needle_level is None or self.needle_level == record.levelno:
            if self.needle in record.msg:
                self.found = True

def lo_exceptor(needle, level=None, suppress=False):
    ''' returns a function which will assert the specified log
        string/level when called; optionally suppresses other
        handlers until asserted '''

    levels = {}
    if suppress:
        for handler in lo.handlers:
            levels[handler] = handler.level
            handler.level = logging.FATAL

    needlehandler = NeedleHandler(needle, level)
    lo.addHandler(needlehandler)

    def lo_assert():
        msg = 'expected log message "%s"' % needle
        if level is not None:
            msg += ' (level %s)' % logging.getLevelName(level)
        assert needlehandler.found, msg


# Path: kvarq/log.py
# class ColoredFormatter(logging.Formatter):
#     def format(self, record):
# def color_wrap(handler, emit_bak):
#     def emit(record):
# def set_debug():
# def set_info():
# def set_warning():
# def appendlog(fname):
# def tic(name):
# def toc(name):
# def tictoc(name):
#     def decorator(f):
#         def wrapper(*args, **kwargs):
# def format_traceback(exc_info):


# Path: tests/_util.py
import logging
import functools, pdb, sys
from kvarq.log import lo

        logging.Handler.__init__(self, logging.DEBUG)
        self.needle = needle
        self.needle_level = needle_level
        self.found = False

    def handle(self, record):
        if self.needle_level is None or self.needle_level == record.levelno:
            if self.needle in record.msg:
                self.found = True

def lo_exceptor(needle, level=None, suppress=False):
    ''' returns a function which will assert the specified log
        string/level when called; optionally suppresses other
        handlers until asserted '''

    levels = {}
    if suppress:
        for handler in lo.handlers:
            levels[handler] = handler.level
            handler.level = logging.FATAL

    needlehandler = NeedleHandler(needle, level)
    lo.addHandler(needlehandler)

    def lo_assert():
        msg = 'expected log message "%s"' % needle
        if level is not None:
            msg += ' (level %s)' % logging.getLevelName(level)
        assert needlehandler.found, msg


        lo.removeHandler(needlehandler)