Opened 15 years ago

Closed 15 years ago

#2130 closed defect (wontfix)

VERBOSE() macro for C files

Reported by: pc-mythtrac06a@… Owned by: GoToDev
Priority: minor Milestone: unknown
Component: mythtv Version:
Severity: medium Keywords:
Cc: Ticket locked: no


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.

Attachments (1)

myth-logging.patch (4.9 KB) - added by pc-mythtrac06a@… 15 years ago.

Download all attachments as: .zip

Change History (2)

Changed 15 years ago by pc-mythtrac06a@…

Attachment: myth-logging.patch added

comment:1 Changed 15 years ago by Isaac Richards

Resolution: wontfix
Status: newclosed

External code in libav* should be using the av_log api, which we can wrap in the code that calls ffmpeg functions. We don't want to be changing their code to use myth-specific logging stuff.

Note: See TracTickets for help on using tickets.