mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-12-23 04:30:10 +09: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):
|
||||
"""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'):
|
||||
self.params['logger'].debug(message)
|
||||
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)
|
||||
|
||||
def to_stderr(self, message):
|
||||
def to_stderr(self, message, debug=False, check_quiet=False):
|
||||
"""Print message to stderr."""
|
||||
assert isinstance(message, compat_str)
|
||||
if self.params.get('logger'):
|
||||
if debug:
|
||||
self.params['logger'].debug(message)
|
||||
else:
|
||||
self.params['logger'].error(message)
|
||||
else:
|
||||
if debug and check_quiet and self.params.get('quiet', False):
|
||||
return
|
||||
message = self._bidi_workaround(message)
|
||||
output = message + '\n'
|
||||
self._write_string(output, self._err_file)
|
||||
|
Loading…
Reference in New Issue
Block a user