Add timestamps to minimal logging

Hi we are working on a matter project using ncs v2.6.0

Currently we are running out of RAM memory and that´s why we have moved to minimal logging by enabling 

CONFIG_LOG_MODE_MINIMAL=y
Now we would like to add timestamps to the logs, but we don´t want to move to deferred logging because it takes too much more RAM.
Here my questions:
  • Is there a way to enable/add timestamps using minimal logging?
  • Is there a way to disable some features of deferred logging to keep it as minimal as possible but logging timestamps?

Thanks

Hugo

Parents
  • Hi, 

    Is there a way to enable/add timestamps using minimal logging?

    Are you using CONFIG_LOG_BACKEND_FORMAT_TIMESTAMP or CONFIG_LOG_TIMESTAMP_64BIT? If so, see the configs dependencies

    Is there a way to disable some features of deferred logging to keep it as minimal as possible but logging timestamps?

    To minimize the memory usage of deferred logging, you can adjust the log level. Setting a higher default log level will reduce the number of log messages compiled into the firmware:

    CONFIG_LOG_DEFAULT_LEVEL=3  # Set to INFO level

    Logger module explains that logs can be filtered out based on module and severity level during compilation.

    You can also disable some features that you don't need, such as coloring:

    CONFIG_LOG_BACKEND_SHOW_COLOR=n

    If the above still cannot help, you might consider disabling some other features or Memory footprint optimization.

    Regards,
    Amanda H.

  • Ok, I see, as I thought CONFIG_LOG_MODE_MINIMAL excludes timestamps

    Then I tried CONFIG_LOG_BACKEND_SHOW_COLOR=n but it does not make any diff.

    About Memory footprint optimization we have already been there, not much more to optimize.

    I wonder if I can enable the CONFIG_LOG_CUSTOM_HEADER option in order to define a minimal log with timestamps.
    But when trying it I cannot make the compiler find my zephyr_custom_log.h file.

    I added zephyr_include_directories in our CMakeLists.txt pointing to the directory holding the header file but it still fails to compile

    Any ideas about what I can be missing?

    Thanks

Reply
  • Ok, I see, as I thought CONFIG_LOG_MODE_MINIMAL excludes timestamps

    Then I tried CONFIG_LOG_BACKEND_SHOW_COLOR=n but it does not make any diff.

    About Memory footprint optimization we have already been there, not much more to optimize.

    I wonder if I can enable the CONFIG_LOG_CUSTOM_HEADER option in order to define a minimal log with timestamps.
    But when trying it I cannot make the compiler find my zephyr_custom_log.h file.

    I added zephyr_include_directories in our CMakeLists.txt pointing to the directory holding the header file but it still fails to compile

    Any ideas about what I can be missing?

    Thanks

Children
Related