~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 11:39:27 UTC
  • mto: This revision was merged to the branch mainline in revision 435.
  • Revision ID: john@arbash-meinel.com-20110316113927-t2e1h8n1tsal9zpi
When logging to stderr, we don't really need the timestamp and branch name.
It is nice in a long-term log file, but to stderr it tends to just cause
the output to wrap, which is ugly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009 Canonical Ltd
 
1
# Copyright 2009, 2010, 2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
26
26
 
27
27
"""Loggerhead web viewer for Bazaar branches.
28
28
 
29
 
This provides a new option "--http" to the "bzr serve" command, that 
 
29
This provides a new option "--http" to the "bzr serve" command, that
30
30
starts a web server to browse the contents of a branch.
31
31
"""
32
32
 
38
38
 
39
39
    require_any_api(bzrlib, [
40
40
        (1, 13, 0), (1, 15, 0), (1, 16, 0), (1, 17, 0), (1, 18, 0),
41
 
        (2, 0, 0), (2, 1, 0)])
 
41
        (2, 0, 0), (2, 1, 0), (2, 2, 0)])
42
42
 
43
43
    # NB: Normally plugins should lazily load almost everything, but this
44
44
    # seems reasonable to have in-line here: bzrlib.commands and options are
65
65
        # loggerhead internal code will try to 'import loggerhead', so
66
66
        # let's put it on the path if we can't find it in the existing path
67
67
        try:
68
 
            import loggerhead
 
68
            import loggerhead.apps.transport
69
69
        except ImportError:
70
70
            import os.path, sys
71
71
            sys.path.append(os.path.dirname(__file__))
72
72
 
73
73
        from loggerhead.apps.transport import BranchesFromTransportRoot
74
74
        from loggerhead.config import LoggerheadConfig
 
75
        from loggerhead.main import setup_logging
75
76
 
76
77
        if host is None:
77
78
            host = DEFAULT_HOST
81
82
        if not transport.is_readonly():
82
83
            argv.insert(0, '--allow-writes')
83
84
        config = LoggerheadConfig(argv)
 
85
        setup_logging(config, init_logging=False, log_file=sys.stderr)
84
86
        app = BranchesFromTransportRoot(transport.base, config)
85
87
        app = HTTPExceptionHandler(app)
86
88
        serve(app, host=host, port=port)