[mythtv-commits] Ticket #2130: VERBOSE() macro for C files
MythTV
mythtv at cvs.mythtv.org
Mon Aug 7 17:07:03 UTC 2006
#2130: VERBOSE() macro for C files
-------------------------------------------+--------------------------------
Reporter: pc-mythtrac06a at crowcastle.net | Owner: GoToDev
Type: defect | Status: new
Priority: minor | Milestone:
Component: mythtv | Version:
Severity: medium |
-------------------------------------------+--------------------------------
Looking through the log files, I see a bunch of entries that don't begin
with timestamps. From the code, I found that this is because the
timestamps are added by the VERBOSE macro, and that is only defined for
C++. In C, logging is done unconditionally with printf().
Once this is defined for C, it should be a rather simple matter to change
the printf statements to VERBOSE.
There are two obvious approaches to use:
1) Write a C++ function that can be called from C.
2) Define a separate C version of the macro.
I'm attaching a patch that takes approach 2. It works, but it duplicates
the code for the flags from mythcontext.h. The right way of doing it
would be to split mythcontext.h into two include files, separating the C++
aspects from the logging definitions. A simple way of doing that would be
to #inlcude my new logging.h in mythcontext.h (and then undef VERBOSE
before putting in the C++ version). Or preprocessor defines could be used
to separate out the code that is specific to C or C++.
I'm also clueless as to the right directory for logging.h, or the issues
regarding which library to include verbose_from_c() into for approach 1.
--
Ticket URL: <http://svn.mythtv.org/trac/ticket/2130>
MythTV <http://www.mythtv.org/>
MythTV
More information about the mythtv-commits
mailing list