~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: Martin Pool
  • Date: 2005-09-07 04:03:13 UTC
  • Revision ID: mbp@sourcefrog.net-20050907040313-1e88d4734a94357d
- when BZR_DEBUG is set, show all trace to stderr and full exceptions

Show diffs side-by-side

added added

removed removed

Lines of Context:
181
181
    global _stderr_handler, _file_handler
182
182
 
183
183
    _stderr_handler = logging.StreamHandler()
184
 
    _stderr_handler.setFormatter(QuietFormatter())
185
184
 
186
185
    if not _file_handler:
187
 
        open_tracefile()
 
186
        open_tracefile()                # also adds it
188
187
 
189
188
    if os.environ.get('BZR_DEBUG'):
190
189
        level = logging.DEBUG
191
190
    else:
192
191
        level = logging.INFO
 
192
        # show only summary of exceptions
 
193
        _stderr_handler.setFormatter(QuietFormatter())
193
194
 
194
 
    _stderr_handler.setLevel(logging.INFO)
 
195
    _stderr_handler.setLevel(level)
195
196
    _file_handler.setLevel(level)
196
197
 
197
198
    logging.getLogger('').addHandler(_stderr_handler)