Move debugging output to -d
option
This commit is contained in:
parent
19e230932f
commit
77f87e5299
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3.7
|
#!/usr/bin/env python3.7
|
||||||
import csv
|
import csv
|
||||||
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -8,6 +9,7 @@ import sys
|
|||||||
import click
|
import click
|
||||||
import requests
|
import requests
|
||||||
from peewee import fn, JOIN
|
from peewee import fn, JOIN
|
||||||
|
from textual.logging import TextualHandler
|
||||||
|
|
||||||
from .db import (
|
from .db import (
|
||||||
db,
|
db,
|
||||||
@ -29,8 +31,15 @@ db.init(HAMSTER_FILE)
|
|||||||
|
|
||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
def cli():
|
@click.option("-d", "--debug", is_flag=True)
|
||||||
pass
|
def cli(debug):
|
||||||
|
if debug:
|
||||||
|
peewee_logger = logging.getLogger("peewee")
|
||||||
|
peewee_logger.addHandler(TextualHandler())
|
||||||
|
peewee_logger.setLevel(logging.DEBUG)
|
||||||
|
requests_log = logging.getLogger("requests.packages.urllib3")
|
||||||
|
requests_log.setLevel(logging.DEBUG)
|
||||||
|
requests_log.propagate = True
|
||||||
|
|
||||||
|
|
||||||
@cli.group()
|
@cli.group()
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import logging
|
|
||||||
from peewee import (
|
from peewee import (
|
||||||
SqliteDatabase,
|
SqliteDatabase,
|
||||||
Model,
|
Model,
|
||||||
@ -10,11 +9,6 @@ from peewee import (
|
|||||||
BooleanField,
|
BooleanField,
|
||||||
)
|
)
|
||||||
|
|
||||||
from textual.logging import TextualHandler
|
|
||||||
|
|
||||||
# logger = logging.getLogger("peewee")
|
|
||||||
# logger.addHandler(TextualHandler())
|
|
||||||
# logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
db = SqliteDatabase(None)
|
db = SqliteDatabase(None)
|
||||||
|
|
||||||
|
@ -4,16 +4,9 @@ import sys
|
|||||||
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import logging
|
|
||||||
|
|
||||||
from hamstertools.kimai import KimaiAPI, Timesheet, Project, Activity
|
from hamstertools.kimai import KimaiAPI, Timesheet, Project, Activity
|
||||||
|
|
||||||
logging.basicConfig()
|
|
||||||
logging.getLogger().setLevel(logging.DEBUG)
|
|
||||||
requests_log = logging.getLogger("requests.packages.urllib3")
|
|
||||||
requests_log.setLevel(logging.DEBUG)
|
|
||||||
requests_log.propagate = True
|
|
||||||
|
|
||||||
api = KimaiAPI()
|
api = KimaiAPI()
|
||||||
|
|
||||||
# print(Timesheet.list(api))
|
# print(Timesheet.list(api))
|
||||||
|
Loading…
Reference in New Issue
Block a user