Skip to content

feat(logger): Add copy and move constructors. Fix bug in include_time config.#434

Merged
finger563 merged 4 commits intomainfrom
feat/logger-copy-move
May 14, 2025
Merged

feat(logger): Add copy and move constructors. Fix bug in include_time config.#434
finger563 merged 4 commits intomainfrom
feat/logger-copy-move

Conversation

@finger563
Copy link
Contributor

@finger563 finger563 commented May 14, 2025

Description

  • Add copy and move constructors to logger component
  • Fix bug in logger constructor which was not using the Config::include_time member
  • Update logger/example to test include_time constructor as well as to test new copy/move constructors

Motivation and Context

Allows loggers and base components to be copied / moved, enabling richer programming and more varied use cases.

How has this been tested?

Build and run logger/example on QtPy ESP32s3

Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):

CleanShot 2025-05-14 at 10 11 32

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Checklist:

  • My change requires a change to the documentation.
  • I have added / updated the documentation related to this change via either README or WIKI

Software

  • I have added tests to cover my changes.
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

* Update `logger` to have `copy` and `move` constructors
* Update `logger` to fix bug in which the `include_time` member of the Config was not being used / saved in constructor
* Update `logger/example` to test `include_time` as well as the new `copy` and `move` constructors`

Allows loggers and base components to be copied / moved, enabling richer programming and more varied use cases.

Build and run `logger/example` on QtPy ESP32s3
@github-actions
Copy link

github-actions bot commented May 14, 2025

✅Static analysis result - no issues found! ✅

@finger563 finger563 requested a review from Copilot May 14, 2025 15:26
@finger563 finger563 assigned finger563 and unassigned finger563 May 14, 2025
@finger563 finger563 added bug Something isn't working enhancement New feature or request logger labels May 14, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds copy and move constructors to the logger component, fixes a bug where the logger constructor did not honor the include_time configuration, and updates the example to test the new constructor behaviors.

  • Introduced copy and move constructors and updated member initialization.
  • Fixed the logger constructor to correctly use Config::include_time.
  • Enhanced logger examples to demonstrate copy/move functionality.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
components/logger/include/logger_formatters.hpp Added custom fmt::formatter specialization for Verbosity enum.
components/logger/include/logger.hpp Added copy/move constructors and fixed include_time usage.
components/logger/example/main/logger_example.cpp Updated examples to cover copy/move constructors.

@finger563 finger563 requested a review from Copilot May 14, 2025 15:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds copy and move constructors to the logger component while fixing a bug where the logger constructor ignored the Config::include_time flag. Additionally, the logger example has been updated to demonstrate and test the new copy/move behaviors.

  • Added copy and move constructors in logger.hpp.
  • Fixed the logger constructor to properly set include_time.
  • Updated logger example to test copy/move operations.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
components/logger/include/logger_formatters.hpp Added a formatter specialization for Logger::Verbosity
components/logger/include/logger.hpp Implemented and updated copy/move constructors and include_time fix
components/logger/example/main/logger_example.cpp Added examples testing the new logger constructors

@finger563 finger563 merged commit d8ac162 into main May 14, 2025
78 checks passed
@finger563 finger563 deleted the feat/logger-copy-move branch May 14, 2025 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request logger

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants