Skip to content

Add Logging for File Operations #8

@arya2004

Description

@arya2004

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.

# ...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...

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions