~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: John Arbash Meinel
  • Date: 2010-04-13 20:58:20 UTC
  • mto: This revision was merged to the branch mainline in revision 408.
  • Revision ID: john@arbash-meinel.com-20100413205820-ctgno1xbshj4803o
The basic support seems to be working, as evidenced by running against bzr.dev.

I can also see that history-db is being triggered, which is probably a good sign.
I haven't eliminated all O(history) calls yet, but we should be moving closer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
    HELP = ('Loggerhead, a web-based code viewer and server. (default port: %d)' %
59
59
            (DEFAULT_PORT,))
60
60
 
 
61
    def setup_logging(config):
 
62
        import logging
 
63
        import sys
 
64
 
 
65
        logger = logging.getLogger('loggerhead')
 
66
        handler = logging.StreamHandler(sys.stderr)
 
67
        handler.setLevel(logging.DEBUG)
 
68
        logger.addHandler(handler)
 
69
        logging.getLogger('simpleTAL').addHandler(handler)
 
70
        logging.getLogger('simpleTALES').addHandler(handler)
 
71
 
61
72
    def serve_http(transport, host=None, port=None, inet=None):
62
73
        from paste.httpexceptions import HTTPExceptionHandler
63
74
        from paste.httpserver import serve
81
92
        if not transport.is_readonly():
82
93
            argv.insert(0, '--allow-writes')
83
94
        config = LoggerheadConfig(argv)
 
95
        setup_logging(config)
84
96
        app = BranchesFromTransportRoot(transport.base, config)
85
97
        app = HTTPExceptionHandler(app)
86
98
        serve(app, host=host, port=port)