mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 09:28:51 +00:00
Make it possible to log events to stdout without logging to file.
This commit is contained in:
parent
5a0f524b5e
commit
9b8c3872c6
@ -20,8 +20,7 @@ def setup_logging():
|
||||
logging.getLogger().addHandler(handler)
|
||||
logging.getLogger().setLevel(settings.LOG_LEVEL)
|
||||
|
||||
if settings.EVENTS_LOG_PATH:
|
||||
events.setup_logging(settings.EVENTS_LOG_PATH, settings.EVENTS_CONSOLE_OUTPUT)
|
||||
events.setup_logging(settings.EVENTS_LOG_PATH, settings.EVENTS_CONSOLE_OUTPUT)
|
||||
|
||||
setup_logging()
|
||||
|
||||
|
@ -6,10 +6,11 @@ logger.propagate = False
|
||||
|
||||
|
||||
def setup_logging(log_path, console_output=False):
|
||||
fh = logging.FileHandler(log_path)
|
||||
formatter = logging.Formatter('%(message)s')
|
||||
fh.setFormatter(formatter)
|
||||
logger.addHandler(fh)
|
||||
if log_path:
|
||||
fh = logging.FileHandler(log_path)
|
||||
formatter = logging.Formatter('%(message)s')
|
||||
fh.setFormatter(formatter)
|
||||
logger.addHandler(fh)
|
||||
|
||||
if console_output:
|
||||
handler = logging.StreamHandler()
|
||||
|
Loading…
Reference in New Issue
Block a user