~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: Robey Pointer
  • Date: 2005-11-07 23:07:05 UTC
  • mto: (1185.49.5 sftp-fix)
  • mto: This revision was merged to the branch mainline in revision 1518.
  • Revision ID: robey@lag.net-20051107230705-e576babae389e326
turn --quiet into a universal option, and make it squelch note/info-level messages

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
 
47
47
_file_handler = None
48
48
_stderr_handler = None
 
49
_stderr_quiet = False
49
50
 
50
51
 
51
52
class QuietFormatter(logging.Formatter):
207
208
    logging.getLogger('').addHandler(_stderr_handler)
208
209
 
209
210
 
 
211
def be_quiet(quiet=True):
 
212
    global _stderr_handler, _stderr_quiet
 
213
    
 
214
    _stderr_quiet = quiet
 
215
    if quiet:
 
216
        _stderr_handler.setLevel(logging.WARNING)
 
217
    else:
 
218
        _stderr_handler.setLevel(logging.INFO)
 
219
 
 
220
 
 
221
def is_quiet():
 
222
    global _stderr_quiet
 
223
    return _stderr_quiet
 
224
 
 
225
 
210
226
def disable_default_logging():
211
227
    """Turn off default log handlers.
212
228