mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-05 07:33:42 +02:00
...
This commit is contained in:
parent
044b786778
commit
c4ae3b9da0
2 changed files with 8 additions and 1 deletions
|
|
@ -15,6 +15,9 @@ def __init__(self, libraries):
|
|||
|
||||
class Context(object):
|
||||
|
||||
log = None
|
||||
url_for = None
|
||||
|
||||
def __init__(self, libraries):
|
||||
self.library_broker = LibraryBroker(libraries)
|
||||
|
||||
|
|
@ -25,3 +28,6 @@ def __init__(self, libraries, opts):
|
|||
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…
Reference in a new issue