diff --git a/deluge/ui/ui.py b/deluge/ui/ui.py index e52530dad..6d84a2a32 100644 --- a/deluge/ui/ui.py +++ b/deluge/ui/ui.py @@ -26,8 +26,6 @@ from optparse import OptionParser, OptionGroup import deluge.common import deluge.configmanager -from deluge.log import LOG as log - DEFAULT_PREFS = { "default_ui": "gtk" } @@ -35,7 +33,6 @@ DEFAULT_PREFS = { class _UI(object): def __init__(self, name="gtk"): - log.debug("NewUI init...") self.__name = name usage="%prog [options] [actions]", @@ -69,13 +66,30 @@ class _UI(object): @property def args(self): - return self._args + return self.__args def start(self): (self.__options, self.__args) = self.__parser.parse_args() + if self.options.quiet: + self.options.loglevel = "none" + + # Setup the logger + import deluge.log + deluge.log.setupLogger( + level=self.options.loglevel, + filename=self.options.logfile + ) + + import deluge.common + log = deluge.log.LOG + log.info('Deluge %s ui %s', self.name, deluge.common.get_version()) + log.debug('options: %s', self.options) + log.debug('args: %s', self.args) + log.info('Starting ui...') class UI: def __init__(self, options, args, ui_args): + from deluge.log import LOG as log log.debug("UI init..") # Set the config directory diff --git a/deluge/ui/web/web.py b/deluge/ui/web/web.py index c18237f64..e20011762 100644 --- a/deluge/ui/web/web.py +++ b/deluge/ui/web/web.py @@ -22,7 +22,6 @@ # Boston, MA 02110-1301, USA. # -import server from deluge.ui.ui import _UI, UI from optparse import OptionGroup @@ -38,7 +37,7 @@ class Web(_UI): def __init__(self): super(Web, self).__init__("web") - self.__server = server.DelugeWeb() + self.__server = None group = OptionGroup(self.parser, "Web Options") group.add_option("-p", "--port", dest="port", type="int", @@ -52,7 +51,13 @@ class Web(_UI): def start(self): super(Web, self).start() - if self.options.port: self.server.port = self.options.port + + import server + self.__server = server.DelugeWeb() + + if self.options.port: + self.server.port = self.options.port + self.server.start() def start():