1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 02:14:32 +01:00

Remove ERROR: prefix on messages if logger is set

This commit is contained in:
Brian Turek 2020-04-24 07:41:12 +01:00
parent 38db9a405a
commit 5209797cb1
No known key found for this signature in database
GPG Key ID: FBAC9908001A6F76

View File

@ -614,14 +614,17 @@ class YoutubeDL(object):
def report_error(self, message, tb=None): def report_error(self, message, tb=None):
''' '''
Do the same as trouble, but prefixes the message with 'ERROR:', colored Do the same as trouble, but prefixes the message with 'ERROR:' if logger is not set, colored
in red if stderr is a tty file. in red if stderr is a tty file.
''' '''
if not self.params.get('no_color') and self._err_file.isatty() and compat_os_name != 'nt': if self.params.get('logger') is not None:
_msg_header = '\033[0;31mERROR:\033[0m' error_message = message
else: else:
_msg_header = 'ERROR:' if not self.params.get('no_color') and self._err_file.isatty() and compat_os_name != 'nt':
error_message = '%s %s' % (_msg_header, message) _msg_header = '\033[0;31mERROR:\033[0m'
else:
_msg_header = 'ERROR:'
error_message = '%s %s' % (_msg_header, message)
self.trouble(error_message, tb) self.trouble(error_message, tb)
def report_file_already_downloaded(self, file_name): def report_file_already_downloaded(self, file_name):