mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-01-23 10:47:37 +01:00
[YoutubeDL] direct debug messages to stderr
This commit is contained in:
parent
7fb9564420
commit
aa2f36a98f
@ -510,6 +510,9 @@ class YoutubeDL(object):
|
|||||||
|
|
||||||
def to_stdout(self, message, skip_eol=False, check_quiet=False):
|
def to_stdout(self, message, skip_eol=False, check_quiet=False):
|
||||||
"""Print message to stdout if not in quiet mode."""
|
"""Print message to stdout if not in quiet mode."""
|
||||||
|
if message.startswith('[debug]'):
|
||||||
|
# dirty fix, direct debug messages to stderr
|
||||||
|
return self.to_stderr(message, debug=True, check_quiet=check_quiet)
|
||||||
if self.params.get('logger'):
|
if self.params.get('logger'):
|
||||||
self.params['logger'].debug(message)
|
self.params['logger'].debug(message)
|
||||||
elif not check_quiet or not self.params.get('quiet', False):
|
elif not check_quiet or not self.params.get('quiet', False):
|
||||||
@ -519,12 +522,17 @@ class YoutubeDL(object):
|
|||||||
|
|
||||||
self._write_string(output, self._screen_file)
|
self._write_string(output, self._screen_file)
|
||||||
|
|
||||||
def to_stderr(self, message):
|
def to_stderr(self, message, debug=False, check_quiet=False):
|
||||||
"""Print message to stderr."""
|
"""Print message to stderr."""
|
||||||
assert isinstance(message, compat_str)
|
assert isinstance(message, compat_str)
|
||||||
if self.params.get('logger'):
|
if self.params.get('logger'):
|
||||||
self.params['logger'].error(message)
|
if debug:
|
||||||
|
self.params['logger'].debug(message)
|
||||||
|
else:
|
||||||
|
self.params['logger'].error(message)
|
||||||
else:
|
else:
|
||||||
|
if debug and check_quiet and self.params.get('quiet', False):
|
||||||
|
return
|
||||||
message = self._bidi_workaround(message)
|
message = self._bidi_workaround(message)
|
||||||
output = message + '\n'
|
output = message + '\n'
|
||||||
self._write_string(output, self._err_file)
|
self._write_string(output, self._err_file)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user