mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
...
This commit is contained in:
parent
044b786778
commit
c4ae3b9da0
@ -15,6 +15,9 @@ class LibraryBroker(object):
|
||||
|
||||
class Context(object):
|
||||
|
||||
log = None
|
||||
url_for = None
|
||||
|
||||
def __init__(self, libraries):
|
||||
self.library_broker = LibraryBroker(libraries)
|
||||
|
||||
@ -25,3 +28,6 @@ class Handler(object):
|
||||
self.router.ctx.url_for = self.router.url_for
|
||||
self.dispatch = self.router.dispatch
|
||||
|
||||
def set_log(self, log):
|
||||
self.router.ctx.log = log
|
||||
|
||||
|
@ -56,11 +56,12 @@ def daemonize(): # {{{
|
||||
class Server(object):
|
||||
|
||||
def __init__(self, libraries, opts):
|
||||
self.handler = Handler(libraries, opts)
|
||||
log = None
|
||||
if opts.log:
|
||||
log = RotatingLog(opts.log, max_size=opts.max_log_size)
|
||||
self.handler = Handler(libraries, opts)
|
||||
self.loop = ServerLoop(create_http_handler(self.handler.dispatch), opts=opts, log=log)
|
||||
self.handler.set_log(self.loop.log)
|
||||
self.serve_forever = self.loop.serve_forever
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user