mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
[fix] log module was redifining constants thus breaking import
This commit is contained in:
parent
4b62016d10
commit
93961e9aae
2 changed files with 14 additions and 10 deletions
|
@ -160,13 +160,13 @@ class TTYHandler(logging.StreamHandler):
|
|||
|
||||
"""
|
||||
LEVELS_COLOR = {
|
||||
logging.NOTSET: 'white',
|
||||
logging.DEBUG: 'white',
|
||||
logging.INFO: 'cyan',
|
||||
logging.SUCCESS: 'green',
|
||||
logging.WARNING: 'yellow',
|
||||
logging.ERROR: 'red',
|
||||
logging.CRITICAL: 'red',
|
||||
log.NOTSET: 'white',
|
||||
log.DEBUG: 'white',
|
||||
log.INFO: 'cyan',
|
||||
log.SUCCESS: 'green',
|
||||
log.WARNING: 'yellow',
|
||||
log.ERROR: 'red',
|
||||
log.CRITICAL: 'red',
|
||||
}
|
||||
|
||||
def __init__(self, message_key='fmessage'):
|
||||
|
@ -178,7 +178,7 @@ class TTYHandler(logging.StreamHandler):
|
|||
msg = record.getMessage()
|
||||
if self.supports_color():
|
||||
level = ''
|
||||
if self.level <= logging.DEBUG:
|
||||
if self.level <= log.DEBUG:
|
||||
# add level name before message
|
||||
level = '%s ' % record.levelname
|
||||
elif record.levelname in ['SUCCESS', 'WARNING', 'ERROR']:
|
||||
|
@ -195,7 +195,7 @@ class TTYHandler(logging.StreamHandler):
|
|||
|
||||
def emit(self, record):
|
||||
# set proper stream first
|
||||
if record.levelno >= logging.WARNING:
|
||||
if record.levelno >= log.WARNING:
|
||||
self.stream = sys.stderr
|
||||
else:
|
||||
self.stream = sys.stdout
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import os
|
||||
import logging
|
||||
from logging import addLevelName, setLoggerClass, Logger, getLogger
|
||||
|
||||
# import all constant because other modules tries to important them from this
|
||||
# module because SUCCESS is defined in this module
|
||||
from logging import (addLevelName, setLoggerClass, Logger, getLogger, NOTSET,
|
||||
DEBUG, INFO, WARNING, ERROR, CRITICAL)
|
||||
|
||||
|
||||
# Global configuration and functions -----------------------------------
|
||||
|
|
Loading…
Reference in a new issue