Skip to content
4 changes: 2 additions & 2 deletions application/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
from werkzeug.exceptions import HTTPException
from werkzeug.serving import WSGIRequestHandler

logger = logging.getLogger(__name__)

try:
with open('log_config.yaml') as config_file:
config = yaml.safe_load(config_file.read())
logging.config.dictConfig(config)
logger = logging.getLogger(__name__)
except Exception:
# Fallback to a basic configuration
logging.basicConfig(format='%(asctime)s %(levelname)s [%(name)s:%(lineno)d] %(message)s', level=logging.INFO, force=True)
logger = logging.getLogger(__name__)
logger.exception("Logging setup failed")
else:
logger.warning("Logging setup is completed with config=%s", config)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Consider limiting logged configuration details.

Logging the entire configuration object could potentially expose sensitive information (like log file paths, credentials in custom handlers) and create verbose log entries.

- logger.warning("Logging setup is completed with config=%s", config)
+ logger.warning("Logging setup completed successfully")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
logger.warning("Logging setup is completed with config=%s", config)
logger.warning("Logging setup completed successfully")

Expand Down
Loading