Skip to content

Conversation

@finger563
Copy link
Contributor

@finger563 finger563 commented Dec 8, 2025

Description

  • Update logger to use esp_log_timestamp() to retrive timestamp for logging on espressif platforms

Motivation and Context

  • Ensures that the logger timestamps are consistent with other esp_log timestamps on espressif platforms. Prior to this change, logger timestamps were offset from the esp_log timestamps (esp_log timestamps were always greater by up to 1 second), which could lead to confusion when correlating log messages.

How has this been tested?

Build and run the logger/example on a QtPy ESP32-S3 board and verify that the logger timestamps match the esp_log timestamps.

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

CleanShot 2025-12-08 at 10 45 48

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.

Copilot AI review requested due to automatic review settings December 8, 2025 16:42
@github-actions
Copy link

github-actions bot commented Dec 8, 2025

✅Static analysis result - no issues found! ✅

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 updates the logger component on ESP platforms to use esp_log_timestamp() instead of esp_timer_get_time() for timestamp generation, ensuring consistency with ESP-IDF's built-in logging timestamps.

  • Changed timestamp source from microseconds (esp_timer_get_time) to milliseconds (esp_log_timestamp)
  • Updated time calculation logic to work with millisecond resolution
  • Added necessary include (esp_log_timestamp.h) and component dependency (log)

Reviewed changes

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

File Description
components/logger/include/logger.hpp Updated includes and modified get_time() to use esp_log_timestamp() with millisecond-based calculations
components/logger/CMakeLists.txt Added log component to ESP platform requirements for esp_log_timestamp API access
components/logger/example/CMakeLists.txt Added esp_vfs_console component to example build dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@finger563 finger563 merged commit c7e68b2 into main Dec 8, 2025
101 of 102 checks passed
@finger563 finger563 deleted the feat/logger-timestamp branch December 8, 2025 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants