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