Add a logging line after webserver is started.

Also remove useless `debug` config option.
This commit is contained in:
Lucas Verney 2018-01-10 19:41:22 +01:00
parent 47ce1ba7e0
commit 45c4eca775
3 changed files with 9 additions and 6 deletions

View File

@ -234,5 +234,4 @@ def serve(config):
# standard logging # standard logging
server = web_app.QuietWSGIRefServer server = web_app.QuietWSGIRefServer
app.run(host=config["host"], port=config["port"], server=server, app.run(host=config["host"], port=config["port"], server=server)
debug=config["debug"])

View File

@ -68,8 +68,6 @@ DEFAULT_CONFIG = {
"search_index": None, "search_index": None,
# Web app port # Web app port
"port": 8080, "port": 8080,
# Debug mode for webserver
"debug": False,
# Web app host to listen on # Web app host to listen on
"host": "127.0.0.1", "host": "127.0.0.1",
# Web server to use to serve the webapp (see Bottle deployment doc) # Web server to use to serve the webapp (see Bottle deployment doc)
@ -133,7 +131,6 @@ def validate_config(config, check_with_data):
assert config["database"] is None or isinstance(config["database"], str) # noqa: E501 assert config["database"] is None or isinstance(config["database"], str) # noqa: E501
assert isinstance(config["debug"], bool)
assert isinstance(config["port"], int) assert isinstance(config["port"], int)
assert isinstance(config["host"], str) assert isinstance(config["host"], str)
assert config["webserver"] is None or isinstance(config["webserver"], str) # noqa: E501 assert config["webserver"] is None or isinstance(config["webserver"], str) # noqa: E501

View File

@ -29,6 +29,13 @@ class QuietWSGIRefServer(bottle.WSGIRefServer):
# pylint: disable=locally-disabled,too-few-public-methods # pylint: disable=locally-disabled,too-few-public-methods
quiet = True quiet = True
def run(self, app):
app.log.info(
'Server is now up and ready! Listening on %s:%s.' %
(self.host, self.port)
)
super(QuietWSGIRefServer, self).run(app)
def _serve_static_file(filename): def _serve_static_file(filename):
""" """
@ -54,7 +61,7 @@ def get_app(config):
app.install(DatabasePlugin(get_session)) app.install(DatabasePlugin(get_session))
app.install(ConfigPlugin(config)) app.install(ConfigPlugin(config))
app.config.setdefault("canister.log_level", logging.root.level) app.config.setdefault("canister.log_level", logging.root.level)
app.config.setdefault("canister.log_path", None) app.config.setdefault("canister.log_path", False)
app.config.setdefault("canister.debug", False) app.config.setdefault("canister.debug", False)
app.install(canister.Canister()) app.install(canister.Canister())
# Use DateAwareJSONEncoder to dump JSON strings # Use DateAwareJSONEncoder to dump JSON strings