Simplify default log output
This commit is contained in:
parent
0cbce06037
commit
cc98052df8
@ -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`.
|
||||
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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('')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user