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

Setting log level by backend

Hello,

I'm not sure if this is possible, but I would like to filter log level depending on which backend is receiving them. For example I would like to set the RTT to debug and add a flashlog backend as well that is set to info or higher.  I can only find settings for the log level at the global and log instance levels, but not per backend.

Is this possible?

Regards,

Mike

Parents
  • Hi Mike

    For clarity, which SDK version are you using?

    It should be possible to define a higher level log setting that automatically configures the backend and log level as you want, based on a single configuration parameter. 

    Something like this:

    // APP_LOG_MODE 0 for RTT logging
    // APP_LOG_MODE 1 for flash logging
    #define APP_LOG_MODE 0 
    
    #if(APP_LOG_MODE == 0)
    
    // Set the backend and log level accordingly
    
    #elif(APP_LOG_MODE == 1)
    
    // Set the backend and log level accordingly
    
    #endif

    Then all you have to do is change a single parameter to switch between the two, and you can easily associate this with a dedicated debug and release build if you want. 

    Best regards
    Torbjørn

Reply
  • Hi Mike

    For clarity, which SDK version are you using?

    It should be possible to define a higher level log setting that automatically configures the backend and log level as you want, based on a single configuration parameter. 

    Something like this:

    // APP_LOG_MODE 0 for RTT logging
    // APP_LOG_MODE 1 for flash logging
    #define APP_LOG_MODE 0 
    
    #if(APP_LOG_MODE == 0)
    
    // Set the backend and log level accordingly
    
    #elif(APP_LOG_MODE == 1)
    
    // Set the backend and log level accordingly
    
    #endif

    Then all you have to do is change a single parameter to switch between the two, and you can easily associate this with a dedicated debug and release build if you want. 

    Best regards
    Torbjørn

Children
  • Hi Torbjørn,

     

    Thanks for your reply. I think I wasn't clear in my question. Although I think I could use your suggestion of changing backends by configuration, what I would prefer to do is in have a single build configure simultaneous multiple backends. One RTT and one flash. I would like the RTT backend to log DEBUG and higher and the flash backend to log at INFO and higher in this one build. This would allow me to view additional debug information when connected to a debugger and not fill up the flash.

    Is this possible?

    Regards,

    Mike

  • Hi Mike

    Thanks for elaborating, now it is clear Slight smile

    This is not possible unfortunately. The system is only designed to allow one backend at a time. 

    Best regards
    Torbjørn

Related