Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable or disable logging #1133

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions av/logging.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ def restore_default_callback():
lib.av_log_set_callback(lib.av_log_default_callback)


cdef bint enabled = True


def set_enabled(value):
"""Enable or disable all logging."""
global enabled
enabled = value


cdef bint print_after_shutdown = False


Expand Down Expand Up @@ -230,6 +239,8 @@ cpdef log(int level, str name, str message):


cdef void log_callback(void *ptr, int level, const char *format, lib.va_list args) nogil:
if not enabled:
return

cdef bint inited = lib.Py_IsInitialized()
if not inited and not print_after_shutdown:
Expand Down