def no_debug_output(request): old = log._level log.set_level(log.logging.WARNING) def teardown(): log.set_level(old) request.addfinalizer(teardown)
def verbose_option(context, verbosity): ''' Basically Python logging levels. CRITICAL: Config errors, at most. ERROR: Normal errors, at most. WARNING: Problems of which vdirsyncer thinks that it can handle them itself, but which might crash other clients. INFO: Normal output. DEBUG: Show e.g. HTTP traffic. Not supposed to be readable by the normal user. ''' verbosity = verbosity.upper() x = getattr(log.logging, verbosity, None) if x is None: raise ValueError(u'Invalid verbosity value: {}'.format(verbosity)) log.set_level(x)
def teardown(): log.set_level(old)