diff --git a/docs/changes.rst b/docs/changes.rst index feb6be0d..3d85f99b 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -16,9 +16,13 @@ No description yet. **Changes** -- Rename :option:`--dump` to :option:`--save-debug-log`. +- Simplify the default log format, :attr:`mopidy.settings.CONSOLE_LOG_FORMAT`. + From a user's point of view: Less noise, more information. +- Rename the :option:`--dump` command line option to + :option:`--save-debug-log`. - Rename setting :attr:`mopidy.settings.DUMP_LOG_FORMAT` to - :attr:`mopidy.settings.DEBUG_LOG_FORMAT`. + :attr:`mopidy.settings.DEBUG_LOG_FORMAT` and use it for :option:`--verbose` + too. - Rename setting :attr:`mopidy.settings.DUMP_LOG_FILENAME` to :attr:`mopidy.settings.DEBUG_LOG_FILENAME`. diff --git a/mopidy/settings.py b/mopidy/settings.py index b90205c7..c9d7b9fc 100644 --- a/mopidy/settings.py +++ b/mopidy/settings.py @@ -20,18 +20,18 @@ BACKENDS = ( u'mopidy.backends.libspotify.LibspotifyBackend', ) -#: The log format used on the console. See -#: http://docs.python.org/library/logging.html#formatter-objects for details on -#: the format. -CONSOLE_LOG_FORMAT = u'%(levelname)-8s %(asctime)s' + \ - ' [%(process)d:%(threadName)s] %(name)s\n %(message)s' +#: The log format used for informational logging. +#: +#: See http://docs.python.org/library/logging.html#formatter-objects for +#: details on the format. +CONSOLE_LOG_FORMAT = u'%(levelname)-8s %(message)s' -#: The log format used for dump logs. +#: The log format used for debug logging. #: -#: Default:: -#: -#: DEBUG_LOG_FILENAME = CONSOLE_LOG_FORMAT -DEBUG_LOG_FORMAT = CONSOLE_LOG_FORMAT +#: See http://docs.python.org/library/logging.html#formatter-objects for +#: details on the format. +DEBUG_LOG_FORMAT = u'%(levelname)-8s %(asctime)s' + \ + ' [%(process)d:%(threadName)s] %(name)s\n %(message)s' #: The file to dump debug log data to when Mopidy is run with the #: :option:`--save-debug-log` option. diff --git a/mopidy/utils/log.py b/mopidy/utils/log.py index 2806f4f3..57c5c494 100644 --- a/mopidy/utils/log.py +++ b/mopidy/utils/log.py @@ -10,12 +10,15 @@ def setup_logging(verbosity_level, save_debug_log): def setup_console_logging(verbosity_level): if verbosity_level == 0: - level = logging.WARNING + log_level = logging.WARNING + log_format = settings.CONSOLE_LOG_FORMAT elif verbosity_level == 2: - level = logging.DEBUG + log_level = logging.DEBUG + log_format = settings.DEBUG_LOG_FORMAT else: - level = logging.INFO - logging.basicConfig(format=settings.CONSOLE_LOG_FORMAT, level=level) + log_level = logging.INFO + log_format = settings.CONSOLE_LOG_FORMAT + logging.basicConfig(format=log_format, level=log_level) def setup_debug_logging_to_file(): root = logging.getLogger('')