arya2004 / arya2004/facilitator

Add Logging for File Operations

Open
#8 2 comments 0 reactions 1 assignee Claimed by @cmarchena View on GitHub
good first issue hacktoberfest hacktoberfest-accepted python
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.