~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-06-08 06:38:32 UTC
  • mfrom: (1685.1.81 encoding)
  • Revision ID: pqm@pqm.ubuntu.com-20060608063832-74b46cf8fdd4567a
(jam,mbp,wvh) Lots of updates to unicode,url,and encoding support

Show diffs side-by-side

added added

removed removed

Lines of Context:
100
100
    if hasattr(_trace_file, 'closed') and _trace_file.closed:
101
101
        return
102
102
    if len(args) > 0:
103
 
        out = fmt % args
 
103
        # It seems that if we do ascii % (unicode, ascii) we can
 
104
        # get a unicode cannot encode ascii error, so make sure that "fmt"
 
105
        # is a unicode string
 
106
        out = unicode(fmt) % args
104
107
    else:
105
108
        out = fmt
106
109
    out += '\n'
107
 
    _trace_file.write(out)
 
110
    try:
 
111
        _trace_file.write(out)
 
112
    except UnicodeError, e:
 
113
        warning('UnicodeError: %s', e)
 
114
        _trace_file.write(repr(out))
 
115
    # TODO: jam 20051227 Consider flushing the trace file to help debugging
 
116
    #_trace_file.flush()
108
117
debug = mutter
109
118
 
110
119