Commit e5e8c448 authored by Inductiveload's avatar Inductiveload
Browse files

WS-stat: improve logging

parent 8df992c8
...@@ -25,6 +25,8 @@ def sql_all_revs_for_index_pages_since(conn, index_id, since): ...@@ -25,6 +25,8 @@ def sql_all_revs_for_index_pages_since(conn, index_id, since):
if not since: if not since:
since = 19700101000000 since = 19700101000000
logging.info(f"Getting revisions on index {index_id} since {since}")
cursor = conn.cursor(dictionary=True) cursor = conn.cursor(dictionary=True)
sql = """ sql = """
...@@ -39,8 +41,12 @@ ORDER BY p.page_id ...@@ -39,8 +41,12 @@ ORDER BY p.page_id
;""" ;"""
cursor.execute(sql, (104, index_id, since)) cursor.execute(sql, (104, index_id, since))
# print(cursor.statement) logging.debug(cursor.statement)
return cursor.fetchall() revs = cursor.fetchall()
logging.info(f"Got {len(revs)} revisions")
return revs
def connect_db(host, db): def connect_db(host, db):
...@@ -261,8 +267,8 @@ ON DUPLICATE KEY UPDATE ...@@ -261,8 +267,8 @@ ON DUPLICATE KEY UPDATE
if only_since_last: if only_since_last:
last_update = self.get_last_index_update(index.pageid) last_update = self.get_last_index_update(index.pageid)
else: else:
last_update = None
last_update = None
myresult = sql_all_revs_for_index_pages_since( myresult = sql_all_revs_for_index_pages_since(
self.mw_conn, index.pageid, last_update) self.mw_conn, index.pageid, last_update)
...@@ -349,6 +355,11 @@ def main(): ...@@ -349,6 +355,11 @@ def main():
log_level = logging.DEBUG if args.verbose else logging.INFO log_level = logging.DEBUG if args.verbose else logging.INFO
logging.basicConfig(level=log_level) logging.basicConfig(level=log_level)
logging.getLogger("urllib3").setLevel(logging.WARNING)
logging.getLogger("oauthlib").setLevel(logging.WARNING)
logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("requests_oauthlib").setLevel(logging.WARNING)
pwbl = logging.getLogger("pywiki") pwbl = logging.getLogger("pywiki")
pwbl.disabled = True pwbl.disabled = True
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment