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:
padreug 2025-07-05 16:50:31 +02:00
parent 5988a25983
commit 3e4effb76f
2 changed files with 9 additions and 1 deletions

View file

@ -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")