Move print statements to logger methods

This commit is contained in:
Marty Oehme 2023-02-23 19:32:43 +01:00
parent 94744fb55f
commit a150259538
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -77,14 +77,14 @@ def query_document(db, author, title):
def add_to_database(author, title, confirm=True, edit=False): def add_to_database(author, title, confirm=True, edit=False):
print(f"Searching - '{title} {author}'") logger.info(f"Searching - '{title} {author}'")
data = None data = None
try: try:
data = papis.isbn.get_data(f"{title}") data = papis.isbn.get_data(f"{title}")
except isbnlib.ISBNLibException as e: except isbnlib.ISBNLibException as e:
print(f"ERROR: {e}") logger.error(e)
else: else:
print(f"Found: {data}") logger.info(f"Found: {data}")
if data: if data:
papis_data = papis.isbn.data_to_papis(data[0]) papis_data = papis.isbn.data_to_papis(data[0])
papis.commands.add.run([], data=papis_data, confirm=confirm, edit=edit) papis.commands.add.run([], data=papis_data, confirm=confirm, edit=edit)