mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
chore: Update logger setup in CLI, Generator, ApiCaller, and JobScheduler classes
This commit updates the logger setup in the CLI, Generator, ApiCaller, and JobScheduler classes to use the `CUSTOM_LOG_LEVEL` environment variable if available, falling back to the `LOG_LEVEL` environment variable if not. This change ensures that the log level can be customized for each class individually.
This commit is contained in:
parent
5db80a78c2
commit
d15c336fad
5 changed files with 5 additions and 5 deletions
|
|
@ -55,7 +55,7 @@ def format_remaining_time(seconds):
|
|||
|
||||
class CLI(ApiCaller):
|
||||
def __init__(self):
|
||||
self.__logger = setup_logger("CLI", getenv("LOG_LEVEL", "INFO"))
|
||||
self.__logger = setup_logger("CLI", getenv("CUSTOM_LOG_LEVEL", getenv("LOG_LEVEL", "INFO")))
|
||||
variables_path = Path(sep, "etc", "nginx", "variables.env")
|
||||
self.__variables = {}
|
||||
self.__db = None
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ CUSTOM_CONF_RX = re_compile(
|
|||
)
|
||||
BUNKERWEB_STATIC_INSTANCES_RX = re_compile(r"(http://)?(?P<hostname>(?<![:@])\b[^:@\s]+\b)(:(?P<port>\d+))?")
|
||||
|
||||
LOGGER = setup_logger("Generator", getenv("LOG_LEVEL", "INFO"))
|
||||
LOGGER = setup_logger("Generator", getenv("CUSTOM_LOG_LEVEL", getenv("LOG_LEVEL", "INFO")))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ from logger import setup_logger
|
|||
class ApiCaller:
|
||||
def __init__(self, apis: Optional[List[API]] = None):
|
||||
self.apis = apis or []
|
||||
self.__logger = setup_logger("Api", getenv("LOG_LEVEL", "INFO"))
|
||||
self.__logger = setup_logger("Api", getenv("CUSTOM_LOG_LEVEL", getenv("LOG_LEVEL", "INFO")))
|
||||
|
||||
def send_to_apis(
|
||||
self,
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class JobScheduler(ApiCaller):
|
|||
apis: Optional[list] = None,
|
||||
):
|
||||
super().__init__(apis or [])
|
||||
self.__logger = logger or setup_logger("Scheduler", getenv("LOG_LEVEL", "INFO"))
|
||||
self.__logger = logger or setup_logger("Scheduler", getenv("CUSTOM_LOG_LEVEL", getenv("LOG_LEVEL", "INFO")))
|
||||
self.__integration = integration
|
||||
self.db = db or Database(self.__logger)
|
||||
self.__env = env or {}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ TMP_DIR = Path(sep, "var", "tmp", "bunkerweb")
|
|||
RUN_DIR = Path(sep, "var", "run", "bunkerweb")
|
||||
|
||||
MAX_WORKERS = int(getenv("MAX_WORKERS", max((cpu_count() or 1) - 1, 1)))
|
||||
LOG_LEVEL = getenv("LOG_LEVEL", "info")
|
||||
LOG_LEVEL = getenv("CUSTOM_LOG_LEVEL", getenv("LOG_LEVEL", "info"))
|
||||
|
||||
wsgi_app = "main:app"
|
||||
proc_name = "bunkerweb-ui"
|
||||
|
|
|
|||
Loading…
Reference in a new issue