Logging
This commit is contained in:
parent
a3858f6395
commit
491df5f942
1 changed files with 9 additions and 1 deletions
10
cry/cli.py
10
cry/cli.py
|
|
@ -1,5 +1,7 @@
|
||||||
# https://simonwillison.net/2023/Sep/30/cli-tools-python/
|
# https://simonwillison.net/2023/Sep/30/cli-tools-python/
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import logging
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
from . import feed
|
from . import feed
|
||||||
|
|
@ -11,8 +13,14 @@ from . import database
|
||||||
@click.option("-v", "--verbose", count=True)
|
@click.option("-v", "--verbose", count=True)
|
||||||
def cli(verbose):
|
def cli(verbose):
|
||||||
"Command line feed reader"
|
"Command line feed reader"
|
||||||
|
if verbose > 1:
|
||||||
|
level = logging.DEBUG
|
||||||
|
elif verbose > 0:
|
||||||
|
level = logging.INFO
|
||||||
|
else:
|
||||||
|
level = logging.WARN
|
||||||
|
|
||||||
click.echo(f"Verbosity: {verbose}")
|
logging.basicConfig(level=level)
|
||||||
|
|
||||||
|
|
||||||
@cli.command(name="subscribe")
|
@cli.command(name="subscribe")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue