Try logging.

This commit is contained in:
Dominik Pantůček 2025-07-12 17:15:22 +02:00
parent 15dfd0be04
commit 3ab537f7d9
2 changed files with 14 additions and 0 deletions

View file

@ -11,6 +11,17 @@ import brmbar
import argparse
import logging
root = logging.getLogger()
root.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
root.addHandler(handler)
# User credit balance limit; sale will fail when balance is below this limit.
LIMIT_BALANCE = -200
# When below this credit balance, an alert hook script (see below) is run.

View file

@ -1,4 +1,6 @@
from .Currency import Currency
import logging
logger = logging.getLogger(__name__)
class Account:
""" BrmBar Account
@ -14,6 +16,7 @@ class Account:
@classmethod
def load_by_barcode(cls, db, barcode):
logger.debug("load_by_barcode: %s", barcode)
res = db.execute_and_fetch("SELECT account FROM barcodes WHERE barcode = %s", [barcode])
if res is None:
return None