Добавить логгирование (log_info, log_error) в функцию
Add structured logging to this function using @logger.py.
Use log_info for key steps and log_error inside try-except blocks.
Make sure logger imports are placed only after setup_project_logger.
Avoid global variables.
Please write all comments and explanations in Russian briefly and concisely,
but at the same time keep in mind that I have almost no experience in creating code.
If possible, offer an example of correcting lines of code or logic,
but do not rewrite the entire file.
If changes are not required, do not rewrite the code.