<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Why was NRF_LOG_PRINTF and its tie-in to Segger output eliminated in SDK 12?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16430/why-was-nrf_log_printf-and-its-tie-in-to-segger-output-eliminated-in-sdk-12</link><description>In SDK 11, there was an immensely useful function known as NRF_LOG_PRINTF. in SDK 12, this seems to have been replaced by NRF_LOG_DEBUG, NRF_LOG_INFO, NRF_LOG_ERROR. However, if you expand the macros to these functions, it becomes clear that the only</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 19 Sep 2016 06:21:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16430/why-was-nrf_log_printf-and-its-tie-in-to-segger-output-eliminated-in-sdk-12" /><item><title>RE: Why was NRF_LOG_PRINTF and its tie-in to Segger output eliminated in SDK 12?</title><link>https://devzone.nordicsemi.com/thread/62870?ContentTypeID=1</link><pubDate>Mon, 19 Sep 2016 06:21:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6fd39c64-af0b-4eeb-a154-9223d339c13a</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;@skarvone (BorkFest): You are right that the logger module in SDK 12 has less support for input than what was there in SDK 11. &lt;a href="https://devzone.nordicsemi.com/question/94990"&gt;This thread&lt;/a&gt; has some more information about it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why was NRF_LOG_PRINTF and its tie-in to Segger output eliminated in SDK 12?</title><link>https://devzone.nordicsemi.com/thread/62869?ContentTypeID=1</link><pubDate>Thu, 15 Sep 2016 18:58:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:993dffd4-c769-4ce9-bbd6-44a8d085ae42</guid><dc:creator>Pierre Landau</dc:creator><description>&lt;p&gt;Sorry about that. According to the suggested example, you can use NRF_LOG_RAW_xxx like NRF_LOG_PRINTF as long as you cast every single parameter to a (uint32_t) regardless of whether it&amp;#39;s a pointer to char, an int, or anything else.  The online docs for NRF_LOG_RAW_xxx are still somewhat lacking.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why was NRF_LOG_PRINTF and its tie-in to Segger output eliminated in SDK 12?</title><link>https://devzone.nordicsemi.com/thread/62868?ContentTypeID=1</link><pubDate>Thu, 15 Sep 2016 18:53:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a647516f-b3c6-4b98-b121-7164a54880ff</guid><dc:creator>Pierre Landau</dc:creator><description>&lt;p&gt;Unfortunately, the new NRF_LOG_xxx macros, while they accept varargs, are rather limited in functionality.  If you want to do something like:&lt;/p&gt;
&lt;p&gt;char day[5] = &amp;quot;Tues&amp;quot;;
NRF_LOG_DEBUG(&amp;quot;today&amp;#39;s date is %s\r\n&amp;quot;, day);&lt;/p&gt;
&lt;p&gt;which worked just fine with NRF_LOG_PRINTF, you now get some horrible error about trying to force a pointer (the pointer to the char array) into a uint32_t.  Expanding the new macros shows why this is the case, since the arguments after the format string are all expected to be uint32_t.&lt;/p&gt;
&lt;p&gt;We have many dozens of NRF_LOG_PRINTF statements sprinkled through our code, and it appears the suggestion is to replace each one by local allocation of a buffer, an sprintf, followed by an NRF_LOG_RAW_INFO(). Seems awfully clumsy, not to mention time-consuming.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why was NRF_LOG_PRINTF and its tie-in to Segger output eliminated in SDK 12?</title><link>https://devzone.nordicsemi.com/thread/62867?ContentTypeID=1</link><pubDate>Thu, 15 Sep 2016 06:34:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00b37be2-9756-4caa-89e8-94953e4bc5ec</guid><dc:creator>BorkFest</dc:creator><description>&lt;p&gt;Actually it seems it got a bit worse with reading the input. The HasInput() got dropped, now if you want to do non-blocking get input (like a terminal over RTT) you need to go around the logging API&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why was NRF_LOG_PRINTF and its tie-in to Segger output eliminated in SDK 12?</title><link>https://devzone.nordicsemi.com/thread/62866?ContentTypeID=1</link><pubDate>Thu, 15 Sep 2016 06:07:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:336e510c-45b0-4d48-be33-161c44dc0d94</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;The logger API (which was experimental in SDK 11) has changed a bit, but the functionality should not be any worse. You can use the &lt;code&gt;NRF_LOG_*()&lt;/code&gt; macros to format strings like you would using &lt;code&gt;printf()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If you want something &lt;code&gt;printf()&lt;/code&gt; like, which is independent of log level, you should use &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.0.0/group__nrf__log.html#ga52fcc01ca50daa79058664f84f1111a8"&gt;&lt;code&gt;NRF_LOG_RAW_INFO()&lt;/code&gt;&lt;/a&gt;. You can see an example of its use in the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.0.0/twi_transaction_mgr_example.html?cp=4_0_0_4_5_33"&gt;TWI Transaction Manager Example&lt;/a&gt; (examples\peripheral\twi_master_using_app_twi).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why was NRF_LOG_PRINTF and its tie-in to Segger output eliminated in SDK 12?</title><link>https://devzone.nordicsemi.com/thread/62865?ContentTypeID=1</link><pubDate>Wed, 14 Sep 2016 19:55:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5504a352-cfe2-4241-9857-bf3c721b43f6</guid><dc:creator>Keton</dc:creator><description>&lt;p&gt;strange, my NRF_LOG_DEBUG happily accepts %X and prints hex and thanks to nrf_log_push() function prints strings as well. And it can handle floats via %f without pulling up a function like sprintf and its many kilobyte dependencies. So for me it&amp;#39;s a major step forward + deferred logging which guarantees almost zero performance penalty. Just take a loot at the docs summary here: &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.0.0/nrf_log.html?cp=4_0_0_3_14_2#nrf_log_usage"&gt;infocenter.nordicsemi.com/.../nrf_log.html&lt;/a&gt; and glance trough the sources.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>