This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

When to use NRF_LOG_FLUSH()

Dear all,

I have noticed that NRF_LOG_FLUSH() function is used in many examples after each nrf_log print function. In some cases though, the program freezes when I try my own implementations.

So my question is when should I use NRF_LOG_FLUSH()  and where.

Thank you for your time

Parents
  • Hi,

    NRF_LOG_FLUSH() is used to force processing of the entire log queue. It can be triggered in case you want to make sure that a log message is processed/output before a specific action, but in general it is best to keep the log processing to the main thread. Calling this function in an interrupt context will block other interrupts from being handled, which could cause timing issues in your application.

    Best regards,
    Jørgen

Reply
  • Hi,

    NRF_LOG_FLUSH() is used to force processing of the entire log queue. It can be triggered in case you want to make sure that a log message is processed/output before a specific action, but in general it is best to keep the log processing to the main thread. Calling this function in an interrupt context will block other interrupts from being handled, which could cause timing issues in your application.

    Best regards,
    Jørgen

Children
Related