Browse Source

Simplify logger code(#1811)

master
Philipp Hagemeister 11 years ago
parent
commit
8bf9319e9c
1 changed files with 3 additions and 3 deletions
  1. 6
      youtube_dl/YoutubeDL.py

6
youtube_dl/YoutubeDL.py

@ -97,7 +97,7 @@ class YoutubeDL(object):
playlistend: Playlist item to end at. playlistend: Playlist item to end at.
matchtitle: Download only matching titles. matchtitle: Download only matching titles.
rejecttitle: Reject downloads for matching titles. rejecttitle: Reject downloads for matching titles.
logger: Log messages to a logging.Logger instance.
logger: Log messages to a logging.Logger instance.
logtostderr: Log messages to stderr instead of stdout. logtostderr: Log messages to stderr instead of stdout.
writedescription: Write the video description to a .description file writedescription: Write the video description to a .description file
writeinfojson: Write the video description to a .info.json file writeinfojson: Write the video description to a .info.json file
@ -193,7 +193,7 @@ class YoutubeDL(object):
def to_screen(self, message, skip_eol=False): def to_screen(self, message, skip_eol=False):
"""Print message to stdout if not in quiet mode.""" """Print message to stdout if not in quiet mode."""
if self.params.get('logger', False):
if self.params.get('logger'):
self.params['logger'].debug(message) self.params['logger'].debug(message)
elif not self.params.get('quiet', False): elif not self.params.get('quiet', False):
terminator = [u'\n', u''][skip_eol] terminator = [u'\n', u''][skip_eol]
@ -203,7 +203,7 @@ class YoutubeDL(object):
def to_stderr(self, message): def to_stderr(self, message):
"""Print message to stderr.""" """Print message to stderr."""
assert type(message) == type(u'') assert type(message) == type(u'')
if self.params.get('logger', False):
if self.params.get('logger'):
self.params['logger'].error(message) self.params['logger'].error(message)
else: else:
output = message + u'\n' output = message + u'\n'

Loading…
Cancel
Save