Example #1
0
 def __init__(self, termcolor=None):
     """
     termcolor - If None, attempt to autodetect whether we are in a terminal
         and turn on terminal colors if we think we are.  If True, force
         terminal colors on.  If False, force terminal colors off.
     """
     if termcolor is None:
         termstyle.auto()
         self.termcolor = bool(termstyle.bold(""))
     else:
         self.termcolor = termcolor
     self._restoreColor()
Example #2
0
 def __init__(self, termcolor=None):
     """
     termcolor - If None, attempt to autodetect whether we are in a terminal
         and turn on terminal colors if we think we are.  If True, force
         terminal colors on.  If False, force terminal colors off.
     """
     if termcolor == None:
         termstyle.auto()
         self.termcolor = bool(termstyle.bold(""))
     else:
         self.termcolor = termcolor
     self._restoreColor()
Example #3
0
    def __init__(self, termcolor=None, html=False):
        """
        termcolor - If None, attempt to autodetect whether we are in a terminal
            and turn on terminal colors if we think we are.  If True, force
            terminal colors on.  If False, force terminal colors off.  This
            value is ignored if html is True.

        html - If true, enables HTML output and causes termcolor to be ignored.
        """
        self.html = html
        if html:
            termcolor = False

        if termcolor == None:
            termstyle.auto()
            self.termcolor = bool(termstyle.bold(""))
        else:
            self.termcolor = termcolor
        self._restoreColor()
Example #4
0
    @classmethod
    def styled(self, msg, style):
        style_specs = self.colours[style]
        color = style_specs.get('color')
        styled = msg
        if color:
            styled = getattr(termstyle, style_specs['color'])(styled)
        for attr in style_specs.get('attrs', []):
            styled = getattr(termstyle, attr)(styled)
        return styled


try:
    import termstyle

    termstyle.auto()
except ImportError:
    import warnings

    LaTeXLoggerColour = LaTeXLogger

latex_logger = LaTeXLogger('pydflatex')
latex_logger.setLevel(logging.DEBUG)

std_handler = logging.StreamHandler()
std_handler.setLevel(logging.INFO)

debug_handler = logging.StreamHandler()
debug_handler.setLevel(logging.DEBUG)

## formatter = logging.Formatter('%(message)s')
Example #5
0
    @classmethod
    def styled(self, msg, style):
        style_specs = self.colours[style]
        color = style_specs.get('color')
        styled = msg
        if color:
            styled = getattr(termstyle, style_specs['color'])(styled)
        for attr in style_specs.get('attrs', []):
            styled = getattr(termstyle, attr)(styled)
        return styled


try:
    import termstyle

    termstyle.auto()
except ImportError:
    import warnings

    LaTeXLoggerColour = LaTeXLogger

latex_logger = LaTeXLogger('pydflatex')
latex_logger.setLevel(logging.DEBUG)

std_handler = logging.StreamHandler()
std_handler.setLevel(logging.INFO)

debug_handler = logging.StreamHandler()
debug_handler.setLevel(logging.DEBUG)

## formatter = logging.Formatter('%(message)s')