Move log level to settings
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
|
|
||||||
LOG_LEVEL = os.getenv("LOG_LEVEL")
|
from telegram_downloader_bot.settings import settings
|
||||||
|
|
||||||
|
|
||||||
def configure_logger(log_level: str) -> logging.Logger:
|
def configure_logger(log_level: str) -> logging.Logger:
|
||||||
@@ -18,4 +17,4 @@ def configure_logger(log_level: str) -> logging.Logger:
|
|||||||
return logging.getLogger()
|
return logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
log = configure_logger(LOG_LEVEL)
|
log = configure_logger(settings.log_level)
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ class Settings(BaseSettings):
|
|||||||
A list or comma-separated string of IDs that are allowed access
|
A list or comma-separated string of IDs that are allowed access
|
||||||
to the bot or application.
|
to the bot or application.
|
||||||
|
|
||||||
|
log_level : str
|
||||||
|
The log level used for logging module.
|
||||||
|
|
||||||
Config:
|
Config:
|
||||||
-------
|
-------
|
||||||
env_file : str
|
env_file : str
|
||||||
@@ -45,6 +48,7 @@ class Settings(BaseSettings):
|
|||||||
bot_token: str
|
bot_token: str
|
||||||
storage: os.path
|
storage: os.path
|
||||||
allowed_ids: str
|
allowed_ids: str
|
||||||
|
log_level: str
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
env_file = ".env"
|
env_file = ".env"
|
||||||
|
|||||||
Reference in New Issue
Block a user