a6b215cec9
Fixed tasks to work with processing.* changes. Moved periodic tasks config to settings.py using CELERYBEAT_SCHEDULE Signed-off-by: volpino <fox91@anche.no>
31 lines
566 B
Python
31 lines
566 B
Python
class FakeLogger(object):
|
|
def __getattr__(self, key):
|
|
return lambda *x, **y: None
|
|
|
|
|
|
def set_verbosity_level(logger, verbosity):
|
|
import logging
|
|
|
|
try:
|
|
verbosity = int(verbosity)
|
|
except (ValueError, TypeError):
|
|
return logger
|
|
|
|
levels = {
|
|
0: logging.DEBUG,
|
|
1: logging.INFO,
|
|
2: logging.WARNING,
|
|
3: logging.ERROR,
|
|
4: logging.CRITICAL
|
|
}
|
|
|
|
if verbosity < 0:
|
|
verbosity = 0
|
|
|
|
if verbosity > 4:
|
|
verbosity = 4
|
|
|
|
logger.setLevel(levels[verbosity])
|
|
|
|
return logger
|