From 71bb709f6d96cbd0d488729b09abc1d69c9911a9 Mon Sep 17 00:00:00 2001 From: Phong Date: Wed, 8 Nov 2023 23:58:57 -0600 Subject: [PATCH] Add in debugging print statements --- IndividualCalendar.py | 2 +- OutlookCalendar.py | 36 +++++++++++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/IndividualCalendar.py b/IndividualCalendar.py index be73792..30a9644 100644 --- a/IndividualCalendar.py +++ b/IndividualCalendar.py @@ -206,5 +206,5 @@ def process_individual_calendars(calendar, start_date, end_date): except KeyError as e: logger.warning(f"Unable to find: " + net_id) - filtered_events = [] + # filtered_events = [] return filtered_events diff --git a/OutlookCalendar.py b/OutlookCalendar.py index 7a995ce..111119e 100644 --- a/OutlookCalendar.py +++ b/OutlookCalendar.py @@ -90,6 +90,8 @@ def main(configs): # Retrieve the group member emails group_members = utils.get_email_list(configs['group_name'], configs['email_list_update_interval']) + #group_members = ["pttran3@illinois.edu"] + # Get access token access_token = utils.acquire_access_token(app, configs['scopes']) @@ -100,16 +102,43 @@ def main(configs): for group in [group_members[i : i + grouping] for i in range(0, len(group_members), grouping)]: individual_calendars = IndividualCalendar.get_individual_calendars(start_date, end_date, group, access_token) + #print("Retrieved Individual Calendars from Outlook") + #print(individual_calendars) individual_calendars_events.extend(IndividualCalendar.process_individual_calendars(individual_calendars, start_date, end_date)) + + print(f"Number of individual_calendars_events: {len(individual_calendars_events)}") + # print("") + print("individual_calendars_events: ") + for e in individual_calendars_events: + print(e) + + print("") + print("----------------------------------------------") + print("") # Retrieve the shared calendar and process it - shared_calendar_id = SharedCalendar.get_shared_calendar_id(configs['shared_calendar_name'], access_token) + debug_calendar = "NCSA Shared Calendar Two" + # shared_calendar_id = SharedCalendar.get_shared_calendar_id(configs['shared_calendar_name'], access_token) + shared_calendar_id = SharedCalendar.get_shared_calendar_id(debug_calendar, access_token) shared_calendar = SharedCalendar.get_shared_calendar(shared_calendar_id, start_date, end_date, access_token) + #print("Retrieved Shared Calendar from Outlook") + #print(shared_calendar) shared_calendar_events, event_ids = SharedCalendar.process_shared_calendar(shared_calendar, group_members) - + + + print(f"Number of shared_calendar_events: {len(shared_calendar_events)}") + for e in shared_calendar_events: + print(e) + + print("") + # print("----------------------------------------------") + # Update the shared calendar SharedCalendar.update_shared_calendar(individual_calendars_events, shared_calendar_events, event_ids, shared_calendar_id, configs['category_name'], configs['category_color'], access_token) + # print("") + print("*****************************************************") + # print("") if args.manual_update: break count = count + 1 @@ -122,7 +151,8 @@ def main(configs): if not path.exists(configs['vcs_directory']): raise KeyError(f"{configs['vcs_directory']} does not exist.") - rotate_file_handler_info = handlers.RotatingFileHandler(f"{configs['vcs_directory']}vcs.log", mode='a', maxBytes=2000000, backupCount=2) + debug_file = 'vcs_debug.log' + rotate_file_handler_info = handlers.RotatingFileHandler(f"{configs['vcs_directory']}{debug_file}.log", mode='a', maxBytes=2000000, backupCount=2) rotate_file_handler_info .setFormatter(fmt=formater) rotate_file_handler_info .setLevel(logging.DEBUG)