[gstreamer-bugs] [Bug 571380] New: Allow user to specify filename and line number for gst_debug_log for compatibility with Python logging module

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Wed Feb 11 17:50:57 PST 2009


If you have any questions why you received this email, please see the text at
the end of this email. Replies to this email are NOT read, please see the text
at the end of this email. You can add comments to this bug at:
  http://bugzilla.gnome.org/show_bug.cgi?id=571380

  GStreamer | gst-python | Ver: git
           Summary: Allow user to specify filename and line number for
                    gst_debug_log for compatibility with Python logging
                    module
           Product: GStreamer
           Version: git
          Platform: Other
        OS/Version: All
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: Normal
         Component: gst-python
        AssignedTo: gstreamer-bugs at lists.sourceforge.net
        ReportedBy: laszlok2 at gmail.com
         QAContact: gstreamer-bugs at lists.sourceforge.net
     GNOME version: Unversioned Enhancement
   GNOME milestone: Unspecified


Here is a patch to create a python method gst.debug_log(), which has parameters
very similar to the C function gst_debug_log(). It differs from gst.debug() in
that it lets you specify the level, filename, function, and line number.

It solves the problem that if the Python code uses a separate logging system
(such as Python's logging module), we can make the logging system redirect
output to Gstreamer but the filename, function and line number that is printed
will always be those from the logging system, and not from where the message
originated. For example:

def mylog(message):
  print message
  gst.debug(message)

def foo():
  mylog("enter foo")
  # do something
  mylog("leave foo")

With the above code, you will see this in the gstreamer log:
0:00:00.167498608  1024  0x9c931d8 DEBUG   python log.py:3:mylog: enter foo
0:00:00.167498700  1024  0x9c931d8 DEBUG   python log.py:3:mylog: leave foo

All debug messages will have the same filename, function and line number.

I have attached a patch from current git, as well as a log.py file which
demonstrates a use case of the patch with Python's logging module.


-- 
See http://bugzilla.gnome.org/page.cgi?id=email.html for more info about why you received
this email, why you can't respond via email, how to stop receiving
emails (or reduce the number you receive), and how to contact someone
if you are having problems with the system.

You can add comments to this bug at http://bugzilla.gnome.org/show_bug.cgi?id=571380.




More information about the Gstreamer-bugs mailing list