Set Log level by env (#3798)

### What problem does this PR solve?

Set Log level by env

### Type of change

- [x] Refactoring
This commit is contained in:
Zhichang Yu
2024-12-02 17:24:39 +08:00
committed by GitHub
parent c4b6df350a
commit c5f13629af
7 changed files with 82 additions and 62 deletions

View File

@ -19,15 +19,10 @@
# beartype_all(conf=BeartypeConf(violation_type=UserWarning)) # <-- emit warnings from all code
import logging
import os
from api.utils.log_utils import initRootLogger
initRootLogger("ragflow_server")
for module in ["pdfminer"]:
module_logger = logging.getLogger(module)
module_logger.setLevel(logging.WARNING)
for module in ["peewee"]:
module_logger = logging.getLogger(module)
module_logger.handlers.clear()
module_logger.propagate = True
LOG_LEVELS = os.environ.get("LOG_LEVELS", "")
initRootLogger("ragflow_server", LOG_LEVELS)
import os
import signal