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

[PLA-2023] Fix error logging #271

Merged
merged 2 commits into from
Oct 16, 2024
Merged

Conversation

enjinabner
Copy link
Contributor

@enjinabner enjinabner commented Oct 16, 2024

PR Type

Bug fix


Description

  • Improved error logging in SyncMetadata by changing the log entry to include the error message in an array format. This enhances the structure and readability of the log.

Changes walkthrough 📝

Relevant files
Bug fix
SyncMetadata.php
Improve error logging structure in SyncMetadata                   

src/Jobs/SyncMetadata.php

  • Modified error logging to include error message in an array.
  • Improved the structure of the error log entry.
  • +1/-1     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    @enjinabner enjinabner added the bug Something isn't working label Oct 16, 2024
    @enjinabner enjinabner self-assigned this Oct 16, 2024
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Error Handling
    Ensure that the error logging captures all necessary details of the exception, including stack trace, for better debugging.

    Copy link

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Enhancement
    Enhance error logging by including the exception trace

    Include the exception trace in the error log to provide more detailed debugging
    information.

    src/Jobs/SyncMetadata.php [40]

    -Log::error("Unable to sync metadata for attribute ID {$this->attributeId}", ['error' => $e->getMessage()]);
    +Log::error("Unable to sync metadata for attribute ID {$this->attributeId}", ['error' => $e->getMessage(), 'trace' => $e->getTraceAsString()]);
    Suggestion importance[1-10]: 8

    Why: Including the exception trace in the error log provides more detailed debugging information, which can be crucial for diagnosing issues. This enhancement improves the quality of logging and aids in faster troubleshooting.

    8

    @enjinabner enjinabner merged commit bdf1f73 into master Oct 16, 2024
    7 checks passed
    @enjinabner enjinabner deleted the feature/pla-2023/fix-logging branch October 16, 2024 10:48
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Development

    Successfully merging this pull request may close these issues.

    2 participants