~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: aaron.bentley at utoronto
  • Date: 2005-09-04 03:32:17 UTC
  • mfrom: (974.1.52)
  • mto: (1185.3.4)
  • mto: This revision was merged to the branch mainline in revision 1178.
  • Revision ID: aaron.bentley@utoronto.ca-20050904033217-821a797652305c14
Disabled urlgrabber

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
        if record.levelno >= logging.WARNING:
59
59
            s += record.levelname + ': '
60
60
            
61
 
        s += record.getMessage()
62
 
 
63
 
        import textwrap
64
 
        s = textwrap.fill(s)
 
61
        s += record.getMessage() 
65
62
            
66
63
        if record.exc_info:
67
64
            # give just a summary of the exception, not the whole thing
184
181
    global _stderr_handler, _file_handler
185
182
 
186
183
    _stderr_handler = logging.StreamHandler()
 
184
    _stderr_handler.setFormatter(QuietFormatter())
187
185
 
188
186
    if not _file_handler:
189
 
        open_tracefile()                # also adds it
 
187
        open_tracefile()
190
188
 
191
 
    debug_flag = False
192
 
    try:
193
 
        debug_flag = bool(os.environ['BZR_DEBUG'])
194
 
    except:
195
 
        pass
196
 
        
197
 
    if debug_flag:
 
189
    if os.environ.get('BZR_DEBUG'):
198
190
        level = logging.DEBUG
199
 
        fmt = '%(levelname)8s: %(message)s'
200
 
        _stderr_handler.setFormatter(logging.Formatter(fmt))
201
191
    else:
202
192
        level = logging.INFO
203
 
        # show only summary of exceptions
204
 
        _stderr_handler.setFormatter(QuietFormatter())
205
193
 
206
 
    _stderr_handler.setLevel(level)
 
194
    _stderr_handler.setLevel(logging.INFO)
207
195
    _file_handler.setLevel(level)
208
196
 
209
197
    logging.getLogger('').addHandler(_stderr_handler)