[refactor] replaced info
logging with debug
for improved logging granularity and removed redundant log statements in backend services
This commit is contained in:
@@ -150,8 +150,6 @@ async def get_news(
|
||||
where_conditions.append("published BETWEEN ? AND ?")
|
||||
params.extend([from_ts, to_ts])
|
||||
|
||||
logger.info(f"Date range: {from_date} to {to_date} (UTC timestamps: {from_ts} to {to_ts})")
|
||||
|
||||
# Build the complete SQL query
|
||||
base_sql = """
|
||||
SELECT id, title, summary, url, published, country, created_at
|
||||
@@ -163,27 +161,13 @@ async def get_news(
|
||||
else:
|
||||
sql = base_sql
|
||||
|
||||
sql += " ORDER BY published DESC LIMIT 1000"
|
||||
|
||||
# Log query info
|
||||
if all_countries and all_dates:
|
||||
logger.info("Querying ALL news articles (no filters)")
|
||||
elif all_countries:
|
||||
logger.info(f"Querying news from ALL countries with date filter")
|
||||
elif all_dates:
|
||||
logger.info(f"Querying ALL dates for countries: {country}")
|
||||
else:
|
||||
logger.info(f"Querying news: countries={country}, timezone={timezone_name}")
|
||||
|
||||
logger.info(f"SQL: {sql}")
|
||||
logger.info(f"Parameters: {params}")
|
||||
sql += " ORDER BY published DESC"
|
||||
|
||||
# Execute the query
|
||||
db.execute(sql, params)
|
||||
rows = db.fetchall()
|
||||
result = [dict(row) for row in rows]
|
||||
|
||||
logger.info(f"Found {len(result)} news articles")
|
||||
return result
|
||||
|
||||
except ValueError as e:
|
||||
|
Reference in New Issue
Block a user