~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: John Arbash Meinel
  • Date: 2011-03-16 12:24:06 UTC
  • mfrom: (436 trunk-rich)
  • mto: This revision was merged to the branch mainline in revision 438.
  • Revision ID: john@arbash-meinel.com-20110316122406-xdv5771vlih6s76q
Merge trunk and resolve NEWS conflict.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    HELP = ('Loggerhead, a web-based code viewer and server. (default port: %d)' %
50
50
            (DEFAULT_PORT,))
51
51
 
52
 
    def setup_logging(config):
53
 
        import logging
54
 
        import sys
55
 
 
56
 
        logger = logging.getLogger('loggerhead')
57
 
        handler = logging.StreamHandler(sys.stderr)
58
 
        handler.setLevel(logging.DEBUG)
59
 
        logger.addHandler(handler)
60
 
        logging.getLogger('simpleTAL').addHandler(handler)
61
 
        logging.getLogger('simpleTALES').addHandler(handler)
62
 
 
63
52
    def _ensure_loggerhead_path():
64
53
        """Ensure that you can 'import loggerhead' and get the root."""
65
54
        # loggerhead internal code will try to 'import loggerhead', so
78
67
 
79
68
        from loggerhead.apps.transport import BranchesFromTransportRoot
80
69
        from loggerhead.config import LoggerheadConfig
 
70
        from loggerhead.main import setup_logging
81
71
 
82
72
        if host is None:
83
73
            host = DEFAULT_HOST
87
77
        if not transport.is_readonly():
88
78
            argv.insert(0, '--allow-writes')
89
79
        config = LoggerheadConfig(argv)
90
 
        setup_logging(config)
 
80
        setup_logging(config, init_logging=False, log_file=sys.stderr)
91
81
        app = BranchesFromTransportRoot(transport.base, config)
92
82
        app = HTTPExceptionHandler(app)
93
83
        serve(app, host=host, port=port)