arya2004 / arya2004/facilitator
Add Logging for File Operations
- Dominant language
- Python
- Stars
- 2
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
In openai_service.py, the `generate_meet_link` function reads from meet_links.txt but doesn't log its actions. Adding logs would make it easier to debug.
**Task:** Add logging to show when the function is reading from the file and when the file is empty or doesn't exist.
```python
# ...existing code...
import logging
def generate_meet_link(provider="google"):
"""
# ...existing code...
"""
if provider == "google":
try:
with open("meet_links.txt", "r+") as f:
links = f.readlines()
if links:
link = links.pop(0).strip()
f.seek(0)
f.writelines(links)
f.truncate()
logging.info(f"Retrieved Meet link from file: {link}")
return link
else:
logging.warning("meet_links.txt is empty. Falling back to API.")
except FileNotFoundError:
logging.warning("meet_links.txt not found. Falling back to API.")
# Fallback to creating a dummy event if the file is empty or doesn't exist.
# ...existing code...
````
Contributor guide
Assessment
This issue has not been assessed yet.