Add colorized logging

Review Request #8614 — Created Jan. 12, 2017 and submitted

Information

RBTools
master

Reviewers

rbt now supports colorized logging when writing to a TTY (otherwise,
uncolored logging will be used). The colors can be specified in
.reviewboardrc in the COLORS variable, which maps logging levels
to colors (as plain text names) or None. An invalid color name will
be mapped to no color.

As part of this, the config parsing for nested (dict) variables has
been updated to be more generic and provide defaults where
appropriate.

  • Ran rbt to pipe and to a file: colored logging was not observed.
  • Ran rbt to a terminal: logging was colored appropriately.

Description From Last Updated

This is kind of hard to follow. Can we not reuse the "color" variable quite so much?

daviddavid

Could avoid some conditionals and repetition if these were just the defaults set at the top of the method.

daviddavid

This could be nested within the if color_name conditional.

daviddavid

This is no longer necessary.

daviddavid

isn't here a color_name.upper?

AL AlexTalker
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        setup.py
        rbtools/utils/filesystem.py
        rbtools/commands/__init__.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        setup.py
        rbtools/utils/filesystem.py
        rbtools/commands/__init__.py
    
    
  2. 
      
brennie
david
  1. 
      
  2. rbtools/commands/__init__.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     

    This is kind of hard to follow. Can we not reuse the "color" variable quite so much?

  3. rbtools/commands/__init__.py (Diff revision 1)
     
     
     
     
     
     
     
     

    Could avoid some conditionals and repetition if these were just the defaults set at the top of the method.

  4. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        setup.py
        rbtools/utils/filesystem.py
        rbtools/commands/__init__.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        setup.py
        rbtools/utils/filesystem.py
        rbtools/commands/__init__.py
    
    
  2. 
      
david
  1. 
      
  2. rbtools/commands/__init__.py (Diff revisions 1 - 2)
     
     
     

    This could be nested within the if color_name conditional.

  3. rbtools/commands/__init__.py (Diff revisions 1 - 2)
     
     
     
     

    This is no longer necessary.

  4. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        setup.py
        rbtools/utils/filesystem.py
        rbtools/commands/__init__.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        setup.py
        rbtools/utils/filesystem.py
        rbtools/commands/__init__.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
brennie
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (c6ca0d6)
AL
  1. 
      
  2. rbtools/commands/__init__.py (Diff revision 3)
     
     
     
     
     

    isn't here a color_name.upper?

  3. 
      
Loading...