本文整理匯總了Python中click_log.simple_verbosity_option方法的典型用法代碼示例。如果您正苦於以下問題:Python click_log.simple_verbosity_option方法的具體用法?Python click_log.simple_verbosity_option怎麽用?Python click_log.simple_verbosity_option使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類click_log
的用法示例。
在下文中一共展示了click_log.simple_verbosity_option方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_early_logging
# 需要導入模塊: import click_log [as 別名]
# 或者: from click_log import simple_verbosity_option [as 別名]
def test_early_logging(runner):
i = None
def callback(context, param, value):
test_logger.debug('catch me {}!'.format(i))
@click.command()
@click_log.simple_verbosity_option(test_logger)
@click.option('--config', is_eager=True, default=None, expose_value=False,
callback=callback)
def cli():
test_logger.debug('hello')
for i in range(2):
result = runner.invoke(cli, ['-v', 'debug'], catch_exceptions=False)
assert 'debug: hello' in result.output
assert 'debug: catch me {}!'.format(i) in result.output
示例2: test_logging_args
# 需要導入模塊: import click_log [as 別名]
# 或者: from click_log import simple_verbosity_option [as 別名]
def test_logging_args(runner):
@click.command()
@click_log.simple_verbosity_option(test_logger)
def cli():
test_logger.debug('hello %s', 'world')
result = runner.invoke(cli, ['-v', 'debug'])
assert 'debug: hello world' in result.output