Rename --dump to --save-debug-log. Rename related settings.

This commit is contained in:
Stein Magnus Jodal 2010-08-24 21:00:10 +02:00
parent 3d40aa7168
commit 0cbce06037
6 changed files with 29 additions and 17 deletions

1
.gitignore vendored
View File

@ -8,4 +8,5 @@ cover/
coverage.xml
dist/
docs/_build/
mopidy.log
nosetests.xml

View File

@ -10,10 +10,18 @@ This change log is used to track all major changes to Mopidy.
No description yet.
**Changes**
**Important changes**
- Added a Last.fm scrobbler. See :mod:`mopidy.frontends.lastfm` for details.
**Changes**
- Rename :option:`--dump` to :option:`--save-debug-log`.
- Rename setting :attr:`mopidy.settings.DUMP_LOG_FORMAT` to
:attr:`mopidy.settings.DEBUG_LOG_FORMAT`.
- Rename setting :attr:`mopidy.settings.DUMP_LOG_FILENAME` to
:attr:`mopidy.settings.DEBUG_LOG_FILENAME`.
0.1.0 (2010-08-23)
==================

View File

@ -28,16 +28,15 @@ class CoreProcess(BaseProcess):
parser.add_option('-v', '--verbose',
action='store_const', const=2, dest='verbosity_level',
help='more output (debug level)')
parser.add_option('--dump',
action='store_true', dest='dump',
help='dump debug log to file')
parser.add_option('--save-debug-log',
action='store_true', dest='save_debug_log',
help='save debug log to "./mopidy.log"')
parser.add_option('--list-settings',
action='callback', callback=list_settings_optparse_callback,
help='list current settings')
return parser.parse_args()[0]
def run_inside_try(self):
logger.info(u'-- Starting Mopidy --')
self.setup()
while True:
message = self.core_queue.get()
@ -51,7 +50,9 @@ class CoreProcess(BaseProcess):
self.frontends = self.setup_frontends(self.core_queue, self.backend)
def setup_logging(self):
setup_logging(self.options.verbosity_level, self.options.dump)
setup_logging(self.options.verbosity_level,
self.options.save_debug_log)
logger.info(u'-- Starting Mopidy --')
def setup_settings(self):
get_or_create_folder('~/.mopidy/')

View File

@ -30,16 +30,16 @@ CONSOLE_LOG_FORMAT = u'%(levelname)-8s %(asctime)s' + \
#:
#: Default::
#:
#: DUMP_LOG_FILENAME = CONSOLE_LOG_FORMAT
DUMP_LOG_FORMAT = CONSOLE_LOG_FORMAT
#: DEBUG_LOG_FILENAME = CONSOLE_LOG_FORMAT
DEBUG_LOG_FORMAT = CONSOLE_LOG_FORMAT
#: The file to dump debug log data to when Mopidy is run with the
#: :option:`--dump` option.
#: :option:`--save-debug-log` option.
#:
#: Default::
#:
#: DUMP_LOG_FILENAME = u'dump.log'
DUMP_LOG_FILENAME = u'dump.log'
#: DEBUG_LOG_FILENAME = u'mopidy.log'
DEBUG_LOG_FILENAME = u'mopidy.log'
#: List of server frontends to use.
#:

View File

@ -3,10 +3,10 @@ import logging.handlers
from mopidy import settings
def setup_logging(verbosity_level, dump):
def setup_logging(verbosity_level, save_debug_log):
setup_console_logging(verbosity_level)
if dump:
setup_dump_logging()
if save_debug_log:
setup_debug_logging_to_file()
def setup_console_logging(verbosity_level):
if verbosity_level == 0:
@ -17,12 +17,12 @@ def setup_console_logging(verbosity_level):
level = logging.INFO
logging.basicConfig(format=settings.CONSOLE_LOG_FORMAT, level=level)
def setup_dump_logging():
def setup_debug_logging_to_file():
root = logging.getLogger('')
root.setLevel(logging.DEBUG)
formatter = logging.Formatter(settings.DUMP_LOG_FORMAT)
formatter = logging.Formatter(settings.DEBUG_LOG_FORMAT)
handler = logging.handlers.RotatingFileHandler(
settings.DUMP_LOG_FILENAME, maxBytes=102400, backupCount=3)
settings.DEBUG_LOG_FILENAME, maxBytes=102400, backupCount=3)
handler.setFormatter(formatter)
root.addHandler(handler)

View File

@ -89,6 +89,8 @@ def validate_settings(defaults, settings):
errors = {}
changed = {
'DUMP_LOG_FILENAME': 'DEBUG_LOG_FILENAME',
'DUMP_LOG_FORMAT': 'DEBUG_LOG_FORMAT',
'FRONTEND': 'FRONTENDS',
'SERVER': None,
'SERVER_HOSTNAME': 'MPD_SERVER_HOSTNAME',