mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Manual pass on sources for better standards.
This commit is contained in:
parent
20662c2a43
commit
519dcdbcb3
9 changed files with 136 additions and 105 deletions
|
|
@ -31,11 +31,10 @@ def ansi(color, text):
|
|||
|
||||
|
||||
class ANSIFormatter(Formatter):
|
||||
"""
|
||||
Convert a `logging.LogRecord' object into colored text, using ANSI escape sequences.
|
||||
"""
|
||||
## colors:
|
||||
"""Convert a `logging.LogRecord' object into colored text, using ANSI
|
||||
escape sequences.
|
||||
|
||||
"""
|
||||
def format(self, record):
|
||||
msg = str(record.msg)
|
||||
if record.levelname == 'INFO':
|
||||
|
|
@ -67,8 +66,8 @@ class TextFormatter(Formatter):
|
|||
def init(level=None, logger=getLogger(), handler=StreamHandler()):
|
||||
logger = logging.getLogger()
|
||||
|
||||
if os.isatty(sys.stdout.fileno()) \
|
||||
and not sys.platform.startswith('win'):
|
||||
if (os.isatty(sys.stdout.fileno())
|
||||
and not sys.platform.startswith('win')):
|
||||
fmt = ANSIFormatter()
|
||||
else:
|
||||
fmt = TextFormatter()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue