~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: Robert Collins
  • Date: 2005-09-14 09:01:06 UTC
  • mto: (1185.1.12)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: robertc@robertcollins.net-20050914090106-50ddfad9500a8ae9
make diff lsdiff/filterdiff friendly

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())
184
185
 
185
186
    if not _file_handler:
186
 
        open_tracefile()                # also adds it
 
187
        open_tracefile()
187
188
 
188
 
    debug_flag = False
189
 
    try:
190
 
        debug_flag = bool(os.environ['BZR_DEBUG'])
191
 
    except:
192
 
        pass
193
 
        
194
 
    if debug_flag:
 
189
    if os.environ.get('BZR_DEBUG'):
195
190
        level = logging.DEBUG
196
 
        fmt = '%(levelname)8s: %(message)s'
197
 
        _stderr_handler.setFormatter(logging.Formatter(fmt))
198
191
    else:
199
192
        level = logging.INFO
200
 
        # show only summary of exceptions
201
 
        _stderr_handler.setFormatter(QuietFormatter())
202
193
 
203
 
    _stderr_handler.setLevel(level)
 
194
    _stderr_handler.setLevel(logging.INFO)
204
195
    _file_handler.setLevel(level)
205
196
 
206
197
    logging.getLogger('').addHandler(_stderr_handler)