oaubert / python-vlc

Python vlc bindings
GNU Lesser General Public License v2.1
381 stars 108 forks source link

Instance: add a set_logger method #273

Open garfvl opened 4 months ago

garfvl commented 4 months ago

This MR adds a way to link libVLC log system to a python logging.Logger object.

A new set_logger method is added to the Instance class to link a logging.Logger to the libvlc_log_set callback setup. The additional info from the log context (vlc module name, file, line, etc) are attached as extra info. The log context test is modified to check the set_logger behavior (as the context info is included in the logger).

Tested on Linux and Windows, should work on macOS.

oaubert commented 2 weeks ago

I did not forget about this one, but I knew I had another (big) one pending for which I should also dedicated some time. Now that https://github.com/oaubert/python-vlc/pull/275 is merged, I can merge this one, but it needs some porting to the new code - no real conflict, just moving things around I think. If you have some time to look at it, great. Else, I will do it some day.