mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
setup: add cli scripts for wayback, cdx-server
fix logging of app name, make most logging debug
This commit is contained in:
parent
40b7a8e921
commit
541c076b77
@ -13,5 +13,8 @@ application = init_app(create_cdx_server_app,
|
||||
load_yaml=True,
|
||||
config_file=DEFAULT_CONFIG)
|
||||
|
||||
def main():
|
||||
start_wsgi_server(application, 'CDX Server')
|
||||
|
||||
if __name__ == "__main__":
|
||||
start_wsgi_server(application)
|
||||
main()
|
||||
|
@ -6,5 +6,8 @@ from pywb.core.pywb_init import create_wb_router
|
||||
#=================================================================
|
||||
application = init_app(create_wb_router, load_yaml=True)
|
||||
|
||||
def main():
|
||||
start_wsgi_server(application, 'Wayback')
|
||||
|
||||
if __name__ == "__main__":
|
||||
start_wsgi_server(application)
|
||||
main()
|
||||
|
@ -114,7 +114,7 @@ DEFAULT_CONFIG_FILE = 'config.yaml'
|
||||
def init_app(init_func, load_yaml=True, config_file=None):
|
||||
logging.basicConfig(format='%(asctime)s: [%(levelname)s]: %(message)s',
|
||||
level=logging.DEBUG)
|
||||
logging.info('')
|
||||
logging.debug('')
|
||||
|
||||
if load_yaml:
|
||||
if not config_file:
|
||||
@ -135,13 +135,13 @@ def init_app(init_func, load_yaml=True, config_file=None):
|
||||
raise
|
||||
else:
|
||||
msg = '*** pywb app inited with config from "%s"!\n'
|
||||
logging.info(msg, init_func.__name__)
|
||||
logging.debug(msg, init_func.__name__)
|
||||
|
||||
return WSGIApp(wb_router)
|
||||
|
||||
|
||||
#=================================================================
|
||||
def start_wsgi_server(the_app): # pragma: no cover
|
||||
def start_wsgi_server(the_app, name): # pragma: no cover
|
||||
from wsgiref.simple_server import make_server
|
||||
from optparse import OptionParser
|
||||
|
||||
@ -158,7 +158,7 @@ def start_wsgi_server(the_app): # pragma: no cover
|
||||
if not port:
|
||||
port = DEFAULT_PORT
|
||||
|
||||
logging.debug('Starting CDX Server on port %s', port)
|
||||
logging.info('Starting %s on port %s', name, port)
|
||||
|
||||
try:
|
||||
httpd = make_server('', port, the_app)
|
||||
@ -166,4 +166,4 @@ def start_wsgi_server(the_app): # pragma: no cover
|
||||
except KeyboardInterrupt as ex:
|
||||
pass
|
||||
finally:
|
||||
logging.debug('Stopping CDX Server')
|
||||
logging.info('Stopping %s', name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user