[BRLTTY] New logging functionality.

Dave Mielke dave at mielke.cc
Sat May 26 12:27:44 EDT 2012


[quoted lines by Nicolas Pitre on 2012/05/26 at 23:31 +0800]

>Secondly, looking at logRouting(), it might be a good idea to push 
>vsprintf usage down into logMessage(), or alternatively to move the log 
>level test up, so to avoid wasted CPU cycles doing string formatting if 
>the log level is too low and the formatted string won't be used in the 
>end.

I've gone half way. :-) The only formatting logRouting() does now is to prepend 
the "cursor routing:" prefix. It then calls vlogMessage(), which defers the 
formatting to logData(), which only does it if the log level is sufficient. 

In the end, I don't think maximum efficiency matters all that much since that 
code is only executed if the cursor routing category is enabled, and that'd 
only ever be for very specialized debugging. If we really want to make it even 
mroe efficient then all we need do is replicate the "cursor routing" prefix for 
each call, which could easily be done with a #define. That'd be a lot cleaner 
than duplicating all of the log level and category definitions. I don't really 
think that extra level of efficiency will gain much, though, and significant 
added complexity for little gain is rarely worth it.

-- 
Dave Mielke           | 2213 Fox Crescent | The Bible is the very Word of God.
Phone: 1-613-726-0014 | Ottawa, Ontario   | 2011 May 21 is the End of Salvation.
EMail: dave at mielke.cc | Canada  K2A 1H7   | http://Mielke.cc/now.html
http://FamilyRadio.com/                   | http://Mielke.cc/bible/


More information about the BRLTTY mailing list