Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Logging Practices for GitHub Client #154

Closed
monilpat opened this issue Dec 28, 2024 · 0 comments
Closed

Enhance Logging Practices for GitHub Client #154

monilpat opened this issue Dec 28, 2024 · 0 comments
Labels
enhancement New feature or request logging

Comments

@monilpat
Copy link
Collaborator

Feature Request

Is your feature request related to a problem? Please describe.

The current logging practices within the GitHubClient implementation lack structure and meaningful context, making it difficult to trace operations and debug issues effectively.

Describe the solution you'd like

Implement structured logging using a library like elizaLogger, ensuring that all logs include:

  • Proper log levels (DEBUG, INFO, WARN, ERROR)
  • Structured JSON format
  • Contextual information such as method names and key operation details

Code Example

// Enhance logging in the GitHubClient class
elizaLogger.info('Initializing GitHubClient', { owner: this.config.owner, repo: this.config.repo });

async initialize() {
    elizaLogger.debug('Creating repos directory', { path: this.repoPath });
    await fs.mkdir(path.join(process.cwd(), '.repos', this.config.owner), { recursive: true });
    
    if (!existsSync(this.repoPath)) {
        elizaLogger.info('Cloning repository', { repo: this.config.repo });
        await this.git.clone(
            `https://github.com/${this.config.owner}/${this.config.repo}.git`,
            this.repoPath
        );
    } else {
        elizaLogger.info('Pulling latest changes', { repo: this.config.repo });
        const git = simpleGit(this.repoPath);
        await git.pull();
    }
}

Describe alternatives you've considered

Continuing with the current logging approach, but this would limit our ability to effectively monitor and debug the system.

Additional context

Improving logging practices will enhance observability and aid in faster debugging, leading to a more robust and maintainable system.

@monilpat monilpat added enhancement New feature or request logging labels Dec 28, 2024
@snobbee snobbee closed this as completed Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request logging
Projects
None yet
Development

No branches or pull requests

2 participants