Skip to content

NimBLELog timestamps#1167

Closed
vlucent wants to merge 3 commits into
h2zero:masterfrom
vlucent:log-timestamps
Closed

NimBLELog timestamps#1167
vlucent wants to merge 3 commits into
h2zero:masterfrom
vlucent:log-timestamps

Conversation

@vlucent

@vlucent vlucent commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

adds timestamps to NimBLELog messages :)

Summary by CodeRabbit

  • Bug Fixes
    • Added timestamps to Arduino console log messages, making log output easier to trace and read.
    • Fixed a time-conversion issue in the FreeRTOS porting layer that could cause incorrect behavior during tick-to-millisecond conversion.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Arr! Two small fixes: Arduino log macros in NimBLELog.h now include a millis() timestamp in their output prefix (and pull in <Arduino.h>), and ble_npl_time_ticks_to_ms in the FreeRTOS NPL header is corrected to call npl_freertos_time_ticks_to_ms instead of itself, eliminating infinite recursion.

Changes

Log Timestamp & Recursion Fixes

Layer / File(s) Summary
Arduino log macros: millis() timestamp
src/NimBLELog.h
Adds #include <Arduino.h> and updates NIMBLE_LOGD, NIMBLE_LOGI, NIMBLE_LOGW, NIMBLE_LOGE format strings to include millis() in the log prefix (e.g., D (%lu) %s: ...).
Fix infinite recursion in ticks-to-ms
src/nimble/porting/npl/freertos/include/nimble/nimble_npl_os.h
ble_npl_time_ticks_to_ms now returns the result of npl_freertos_time_ticks_to_ms(ticks, out_ms) instead of recursively calling itself.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

Arr, the logs now show the time, ye scallywag code!
No more recursive loops to Davy Jones' abode!
millis() sails the prefix with a pirate's flair,
And ticks-to-ms no longer loops to nowhere.
Hoist the fixed flag, mateys — smooth seas ahead! ☠️⏱️

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main NimBLELog timestamp change, matey.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@vlucent vlucent changed the title Log timestamps NimBLELog timestamps Jun 29, 2026
@h2zero

h2zero commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Thanks but I don't think this would be a good addition as it's better handled on the logging terminal side.

@vlucent

vlucent commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

Yeah that's a good point :(

@vlucent vlucent closed this Jun 29, 2026
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