Refactor logging and transaction time normalization: Updated the get_client_balance_summary function to use loguru for improved logging clarity. Enhanced transaction processing to normalize transaction_time to UTC, ensuring consistency and accuracy in time handling across transactions.
This commit is contained in:
parent
5988a25983
commit
3e4effb76f
2 changed files with 9 additions and 1 deletions
2
crud.py
2
crud.py
|
|
@ -264,7 +264,7 @@ async def get_client_balance_summary(client_id: str, as_of_time: Optional[dateti
|
|||
|
||||
# Log temporal filtering if as_of_time was used
|
||||
if as_of_time is not None:
|
||||
from lnbits.core.services import logger
|
||||
from loguru import logger
|
||||
# Verify timezone consistency for temporal filtering
|
||||
tz_info = "UTC" if as_of_time.tzinfo == timezone.utc else f"TZ: {as_of_time.tzinfo}"
|
||||
logger.info(f"Client {client_id[:8]}... balance as of {as_of_time} ({tz_info}): deposits.confirmed_at <= cutoff, payments.transaction_time <= cutoff → {total_deposits - total_payments} centavos remaining")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue