Skip to content

Logging improvements #48

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

andreagilardoni
Copy link

The objective of this PR is to improving logging usage by:

  • allow the user to set a macro to define the level of logs that needs to be included in the binary
  • make use of better values for level definitions that may can used with a bit mask logic, which is faster than comparison
  • define logging level enum to restrict the possible values for debug levels
  • Added an example to show the usage of the compile time defined value

Copy link

github-actions bot commented Apr 7, 2025

Memory usage change @ 1a638a0

Board flash % RAM for global variables %
arduino:avr:leonardo 💚 -6 - -6 -0.02 - -0.02 0 - 0 0.0 - 0.0
arduino:avr:mega 💚 -6 - -6 -0.0 - -0.0 0 - 0 0.0 - 0.0
arduino:avr:nano 💚 -6 - -6 -0.02 - -0.02 0 - 0 0.0 - 0.0
arduino:esp32:nano_nora 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_giga:giga 💚 -24 - -24 -0.0 - -0.0 0 - 0 0.0 - 0.0
arduino:mbed_nano:nano33ble 💚 -24 - -24 -0.0 - -0.0 0 - 0 0.0 - 0.0
arduino:mbed_nano:nanorp2040connect 💚 -2 - -2 -0.0 - -0.0 0 - 0 0.0 - 0.0
arduino:mbed_nicla:nicla_vision 💚 -24 - -24 -0.0 - -0.0 0 - 0 0.0 - 0.0
arduino:mbed_opta:opta 🔺 +40 - +40 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
arduino:mbed_portenta:envie_m7:target_core=cm4 N/A N/A N/A N/A
arduino:megaavr:nona4809 💚 -6 - -6 -0.01 - -0.01 0 - 0 0.0 - 0.0
arduino:renesas_portenta:portenta_c33 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:renesas_uno:unor4wifi 🔺 +8 - +8 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:sam:arduino_due_x_dbg 0 - 0 0.0 - 0.0 N/A N/A
arduino:samd:mkrzero 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table
Board examples/Arduino_Debug_Basic
flash
% examples/Arduino_Debug_Basic
RAM for global variables
% examples/Arduino_Debug_Advance
flash
% examples/Arduino_Debug_Advance
RAM for global variables
%
arduino:avr:leonardo -6 -0.02 0 0.0 -6 -0.02 0 0.0
arduino:avr:mega -6 -0.0 0 0.0 -6 -0.0 0 0.0
arduino:avr:nano -6 -0.02 0 0.0 -6 -0.02 0 0.0
arduino:esp32:nano_nora 0 0.0 0 0.0
arduino:mbed_giga:giga -24 -0.0 0 0.0
arduino:mbed_nano:nano33ble -24 -0.0 0 0.0
arduino:mbed_nano:nanorp2040connect -2 -0.0 0 0.0
arduino:mbed_nicla:nicla_vision -24 -0.0 0 0.0
arduino:mbed_opta:opta 40 0.0 0 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
arduino:mbed_portenta:envie_m7:target_core=cm4 N/A N/A N/A N/A
arduino:megaavr:nona4809 -6 -0.01 0 0.0 -6 -0.01 0 0.0
arduino:renesas_portenta:portenta_c33 0 0.0 0 0.0
arduino:renesas_uno:unor4wifi 8 0.0 0 0.0
arduino:sam:arduino_due_x_dbg 0 0.0 N/A N/A
arduino:samd:mkrzero 0 0.0 0 0.0
Click for full report CSV
Board,examples/Arduino_Debug_Basic<br>flash,%,examples/Arduino_Debug_Basic<br>RAM for global variables,%,examples/Arduino_Debug_Advance<br>flash,%,examples/Arduino_Debug_Advance<br>RAM for global variables,%
arduino:avr:leonardo,-6,-0.02,0,0.0,-6,-0.02,0,0.0
arduino:avr:mega,-6,-0.0,0,0.0,-6,-0.0,0,0.0
arduino:avr:nano,-6,-0.02,0,0.0,-6,-0.02,0,0.0
arduino:esp32:nano_nora,0,0.0,0,0.0,,,,
arduino:mbed_giga:giga,-24,-0.0,0,0.0,,,,
arduino:mbed_nano:nano33ble,-24,-0.0,0,0.0,,,,
arduino:mbed_nano:nanorp2040connect,-2,-0.0,0,0.0,,,,
arduino:mbed_nicla:nicla_vision,-24,-0.0,0,0.0,,,,
arduino:mbed_opta:opta,40,0.0,0,0.0,,,,
arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,,,,
arduino:mbed_portenta:envie_m7:target_core=cm4,N/A,N/A,N/A,N/A,,,,
arduino:megaavr:nona4809,-6,-0.01,0,0.0,-6,-0.01,0,0.0
arduino:renesas_portenta:portenta_c33,0,0.0,0,0.0,,,,
arduino:renesas_uno:unor4wifi,8,0.0,0,0.0,,,,
arduino:sam:arduino_due_x_dbg,0,0.0,N/A,N/A,,,,
arduino:samd:mkrzero,0,0.0,0,0.0,,,,

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Apr 7, 2025
Improve values of logging level to allow for bitwise operations for
bitmask instead of comparison operator
in this way we are able to select the debug level that needs to be
included in the sketch at compile time. The default value is to include
all the possible logs
Copy link

github-actions bot commented Apr 8, 2025

Memory usage change @ 5e5387c

Board flash % RAM for global variables %
arduino:avr:leonardo 💚 -6 - -6 -0.02 - -0.02 0 - 0 0.0 - 0.0
arduino:avr:mega 💚 -6 - -6 -0.0 - -0.0 0 - 0 0.0 - 0.0
arduino:avr:nano 💚 -6 - -6 -0.02 - -0.02 0 - 0 0.0 - 0.0
arduino:esp32:nano_nora 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_giga:giga 💚 -24 - -24 -0.0 - -0.0 0 - 0 0.0 - 0.0
arduino:mbed_nano:nano33ble 💚 -24 - -24 -0.0 - -0.0 0 - 0 0.0 - 0.0
arduino:mbed_nano:nanorp2040connect 💚 -2 - -2 -0.0 - -0.0 0 - 0 0.0 - 0.0
arduino:mbed_nicla:nicla_vision 💚 -24 - -24 -0.0 - -0.0 0 - 0 0.0 - 0.0
arduino:mbed_opta:opta 🔺 +40 - +40 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
arduino:mbed_portenta:envie_m7:target_core=cm4 N/A N/A N/A N/A
arduino:megaavr:nona4809 💚 -6 - -6 -0.01 - -0.01 0 - 0 0.0 - 0.0
arduino:renesas_portenta:portenta_c33 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:renesas_uno:unor4wifi 🔺 +8 - +8 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:sam:arduino_due_x_dbg 0 - 0 0.0 - 0.0 N/A N/A
arduino:samd:mkrzero 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table
Board examples/Arduino_Debug_Basic
flash
% examples/Arduino_Debug_Basic
RAM for global variables
% examples/Arduino_Debug_Advance
flash
% examples/Arduino_Debug_Advance
RAM for global variables
%
arduino:avr:leonardo -6 -0.02 0 0.0 -6 -0.02 0 0.0
arduino:avr:mega -6 -0.0 0 0.0 -6 -0.0 0 0.0
arduino:avr:nano -6 -0.02 0 0.0 -6 -0.02 0 0.0
arduino:esp32:nano_nora 0 0.0 0 0.0
arduino:mbed_giga:giga -24 -0.0 0 0.0
arduino:mbed_nano:nano33ble -24 -0.0 0 0.0
arduino:mbed_nano:nanorp2040connect -2 -0.0 0 0.0
arduino:mbed_nicla:nicla_vision -24 -0.0 0 0.0
arduino:mbed_opta:opta 40 0.0 0 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
arduino:mbed_portenta:envie_m7:target_core=cm4 N/A N/A N/A N/A
arduino:megaavr:nona4809 -6 -0.01 0 0.0 -6 -0.01 0 0.0
arduino:renesas_portenta:portenta_c33 0 0.0 0 0.0
arduino:renesas_uno:unor4wifi 8 0.0 0 0.0
arduino:sam:arduino_due_x_dbg 0 0.0 N/A N/A
arduino:samd:mkrzero 0 0.0 0 0.0
Click for full report CSV
Board,examples/Arduino_Debug_Basic<br>flash,%,examples/Arduino_Debug_Basic<br>RAM for global variables,%,examples/Arduino_Debug_Advance<br>flash,%,examples/Arduino_Debug_Advance<br>RAM for global variables,%
arduino:avr:leonardo,-6,-0.02,0,0.0,-6,-0.02,0,0.0
arduino:avr:mega,-6,-0.0,0,0.0,-6,-0.0,0,0.0
arduino:avr:nano,-6,-0.02,0,0.0,-6,-0.02,0,0.0
arduino:esp32:nano_nora,0,0.0,0,0.0,,,,
arduino:mbed_giga:giga,-24,-0.0,0,0.0,,,,
arduino:mbed_nano:nano33ble,-24,-0.0,0,0.0,,,,
arduino:mbed_nano:nanorp2040connect,-2,-0.0,0,0.0,,,,
arduino:mbed_nicla:nicla_vision,-24,-0.0,0,0.0,,,,
arduino:mbed_opta:opta,40,0.0,0,0.0,,,,
arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,,,,
arduino:mbed_portenta:envie_m7:target_core=cm4,N/A,N/A,N/A,N/A,,,,
arduino:megaavr:nona4809,-6,-0.01,0,0.0,-6,-0.01,0,0.0
arduino:renesas_portenta:portenta_c33,0,0.0,0,0.0,,,,
arduino:renesas_uno:unor4wifi,8,0.0,0,0.0,,,,
arduino:sam:arduino_due_x_dbg,0,0.0,N/A,N/A,,,,
arduino:samd:mkrzero,0,0.0,0,0.0,,,,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants