[logging] introduce Log{Level}OnError macros and update core - #12533
Conversation
Summary of ChangesHello @abtink, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the error logging mechanism by introducing a new family of Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request introduces new LogOnError macros to streamline error logging, reducing boilerplate and ensuring consistent log formats. The changes involve replacing existing if (error != kErrorNone) blocks with the new macros across various files. This improves code readability and maintainability by centralizing error logging logic. The comments provided identify redundant checks and suggest format string adjustments for the new logging macros, aligning with best practices for clear and concise code.
Library files
|
This commit introduces a new set of logging macros, `LogCritOnError`, `LogWarnOnError`, `LogNoteOnError`, `LogInfoOnError`, and `LogDebgOnError`, to provide a consistent and streamlined way to log errors across the codebase. The new macros automatically prepend "Failed to " and append the error string (using `ErrorToString()`) to the log message, reducing boilerplate code and ensuring a uniform log format. These macros only emit a log if the provided `Error` is not `kErrorNone`. This change improves code readability and maintainability by consolidating error logging logic into the logging framework.
b220f3a to
be34e2a
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #12533 +/- ##
==========================================
+ Coverage 73.41% 75.05% +1.63%
==========================================
Files 695 698 +3
Lines 95811 95735 -76
==========================================
+ Hits 70340 71851 +1511
+ Misses 25471 23884 -1587
🚀 New features to boost your workflow:
|
This commit introduces a new set of logging macros,
LogCritOnError,LogWarnOnError,LogNoteOnError,LogInfoOnError, andLogDebgOnError, to provide a consistent and streamlined way to log errors across the codebase.The new macros automatically prepend "Failed to " and append the error string (using
ErrorToString()) to the log message, reducing boilerplate code and ensuring a uniform log format. These macros only emit a log if the providedErroris notkErrorNone.This change improves code readability and maintainability by consolidating error logging logic into the logging framework.