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

iox-#1755 Redirect printing in the platform layer to the logger #2222

Conversation

elBoberido
Copy link
Member

@elBoberido elBoberido commented Mar 11, 2024

Pre-Review Checklist for the PR Author

  1. Add a second reviewer for complex new features or larger refactorings
  2. Code follows the coding style of CONTRIBUTING.md
  3. Tests follow the best practice for testing
  4. Changelog updated in the unreleased section including API breaking changes
  5. Branch follows the naming format (iox-123-this-is-a-branch)
  6. Commits messages are according to this guideline
  7. Update the PR title
    • Follow the same conventions as for commit messages
    • Link to the relevant issue
  8. Relevant issues are linked
  9. Add sensible notes for the reviewer
  10. All checks have passed (except task-list-completed)
  11. All touched (C/C++) source code files from iceoryx_hoofs are added to ./clang-tidy-diff-scans.txt
  12. Assign PR to reviewer

Notes for Reviewer

This PR redirects the output from the platform to the hoofs logger once the hoofs logger is initialized.

Checklist for the PR Reviewer

  • Commits are properly organized and messages are according to the guideline
  • Code according to our coding style and naming conventions
  • Unit tests have been written for new behavior
  • Public API changes are documented via doxygen
  • Copyright owner are updated in the changed files
  • All touched (C/C++) source code files from iceoryx_hoofs have been added to ./clang-tidy-diff-scans.txt
  • PR title describes the changes

Post-review Checklist for the PR Author

  1. All open points are addressed and tracked via issues

References

Copy link

codecov bot commented Mar 11, 2024

Codecov Report

Attention: Patch coverage is 58.24176% with 38 lines in your changes are missing coverage. Please review.

Project coverage is 78.51%. Comparing base (19184d4) to head (9a62ad5).
Report is 11 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2222      +/-   ##
==========================================
- Coverage   78.62%   78.51%   -0.12%     
==========================================
  Files         429      431       +2     
  Lines       16538    16629      +91     
  Branches     2308     2333      +25     
==========================================
+ Hits        13003    13056      +53     
- Misses       2682     2707      +25     
- Partials      853      866      +13     
Flag Coverage Δ
unittests 78.30% <58.24%> (-0.12%) ⬇️
unittests_timing 15.32% <9.89%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
.../include/iox/detail/log/building_blocks/logger.inl 58.97% <100.00%> (+1.07%) ⬆️
...porting/include/iox/log/building_blocks/logger.hpp 100.00% <ø> (ø)
iceoryx_hoofs/reporting/source/logging.cpp 78.57% <78.57%> (ø)
iceoryx_platform/generic/source/logging.cpp 48.38% <48.38%> (ø)

@elBoberido elBoberido force-pushed the iox-1755-redirect-printing-in-the-platform-layer-to-the-logger branch from cd0f69c to a97ddbe Compare March 11, 2024 23:46
@elfenpiff elfenpiff self-requested a review March 12, 2024 07:30
elfenpiff
elfenpiff previously approved these changes Mar 12, 2024
Copy link
Contributor

@elfenpiff elfenpiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like it. This is also something we should do for iceoryx2, there we have the same problem. I created there an issue to address this in the future: eclipse-iceoryx/iceoryx2#154

iceoryx_platform/generic/source/logging.cpp Show resolved Hide resolved
std::atomic<LoggerExchangeState> logger_exchange_state{LoggerExchangeState::DEFAULT};
};

IceoryxPlatformLogger& active_logger(IceoryxPlatformLogBackend new_log_backend)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this code was copied from some place else?!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I got inspired :)

I couldn't use the approach from the hoofs logger since it was not possible to expose the atomics so I needed to get creative and came up with this solution. I might even move it to the hoofs logger since it does not require a mutex.

@elBoberido elBoberido merged commit 1e17b23 into eclipse-iceoryx:master Mar 12, 2024
26 checks passed
@elBoberido elBoberido linked an issue Mar 12, 2024 that may be closed by this pull request
8 tasks
@elBoberido elBoberido deleted the iox-1755-redirect-printing-in-the-platform-layer-to-the-logger branch April 6, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance Logger
2 participants