Skip to content

Commit

Permalink
chore: remove unnecessary logs based on ENT-7719
Browse files Browse the repository at this point in the history
  • Loading branch information
justEhmadSaeed committed Nov 21, 2023
1 parent 680dd98 commit ad64859
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 174 deletions.
24 changes: 0 additions & 24 deletions integrated_channels/blackboard/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ def create_content_metadata(self, serialized_data):
copy_of_channel_metadata = copy.deepcopy(channel_metadata_item)
copy_of_channel_metadata['course_metadata']['courseId'] = course_id_generated

LOGGER.info(generate_formatted_log(
self.enterprise_configuration.channel_code(),
self.enterprise_configuration.enterprise_customer.uuid,
None,
external_id,
f"Creating course with courseId: {external_id}, and generated course_id: {course_id_generated}"
))
self._create_session()
create_url = self.generate_course_create_url()
try:
Expand Down Expand Up @@ -111,14 +104,6 @@ def create_content_metadata(self, serialized_data):
HTTPStatus.NOT_FOUND.value
)

LOGGER.info(generate_formatted_log(
self.enterprise_configuration.channel_code(),
self.enterprise_configuration.enterprise_customer.uuid,
None,
external_id,
(f"Creating content page for Blackboard course with course ID={external_id},"
f" and generated course_id: {course_id_generated}")
))
course_created_response = self.create_integration_content_for_course(bb_course_id, copy_of_channel_metadata)

success_body = 'Successfully created Blackboard integration course={bb_course_id} with integration ' \
Expand All @@ -139,15 +124,6 @@ def update_content_metadata(self, serialized_data):
course_id = self._resolve_blackboard_course_id(external_id)
BlackboardAPIClient._validate_course_id(course_id, external_id)

LOGGER.info(
generate_formatted_log(
self.enterprise_configuration.channel_code(),
self.enterprise_configuration.enterprise_customer.uuid,
None,
course_id,
f'Updating course with courseId: {course_id}'
)
)
update_url = self.generate_course_update_url(course_id)
response = self._patch(update_url, channel_metadata_item.get('course_metadata'))

Expand Down
9 changes: 0 additions & 9 deletions integrated_channels/canvas/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ def create_content_metadata(self, serialized_data):
# Do one of 3 things with the fetched canvas course info
# If no course was found, create it
if not located_course:
LOGGER.info(
generate_formatted_log(
self.enterprise_configuration.channel_code(),
self.enterprise_configuration.enterprise_customer.uuid,
None,
edx_course_id,
f'Creating new course with payload {desired_payload}',
)
)
# Course does not exist: Create the course
status_code, response_text = self._post(
self.course_create_url,
Expand Down
26 changes: 0 additions & 26 deletions integrated_channels/degreed2/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,6 @@ def create_course_completion(self, user_id, payload):
Returns: status_code, response_text
"""
json_payload = json.loads(payload)
LOGGER.error(
generate_formatted_log(
self.enterprise_configuration.channel_code(),
self.enterprise_configuration.enterprise_customer.uuid,
user_id,
None,
'[Degreed2Client] - Attempting degreed2 create_course_completion,'
f'payload:{json_payload}'
)
)
LOGGER.info(self.make_log_msg(
json_payload.get('data').get('attributes').get('content-id'),
f'Attempting find course via url: {self.get_completions_url()}'),
user_id
)
code, body = self._post(
self.get_completions_url(),
json_payload,
Expand Down Expand Up @@ -345,7 +330,6 @@ def _sync_content_metadata(self, course_attributes, http_method, override_url, d
if degreed_course_id:
json_to_send['data']['id'] = degreed_course_id

LOGGER.info(self.make_log_msg('', f'About to post payload: {json_to_send}'))
try:
status_code, response_body = getattr(self, '_' + http_method)(
override_url,
Expand Down Expand Up @@ -450,16 +434,6 @@ def _post(self, url, data, scope):
)
)
break
LOGGER.error(
generate_formatted_log(
self.enterprise_configuration.channel_code(),
self.enterprise_configuration.enterprise_customer.uuid,
None,
None,
'[Degreed2Client] - Successfuly called:'
f'RESPONSE:{response}'
)
)
return response.status_code, response.text

def _patch(self, url, data, scope):
Expand Down
9 changes: 0 additions & 9 deletions integrated_channels/degreed2/exporters/learner_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ def get_learner_data_records(
degreed_completed_timestamp = completed_date.strftime('%Y-%m-%dT%H:%M:%S') if isinstance(
completed_date, datetime
) else None
LOGGER.info(generate_formatted_log(
self.enterprise_configuration.channel_code(),
enterprise_enrollment.enterprise_customer_user.enterprise_customer.uuid,
enterprise_enrollment.enterprise_customer_user.user_id,
enterprise_enrollment.course_id,
'[Degreed2Client] - Attempting get_learner_data_records:'
f'percent_grade={percent_grade}, degreed_completed_timestamp={degreed_completed_timestamp}'
f'completed_date={completed_date}, course_completed={course_completed}'
))
try:
remote_id = enterprise_enrollment.enterprise_customer_user.get_remote_id(
self.enterprise_configuration.idp_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,6 @@ def _check_matched_content_to_create(
content_id=content_id,
).first()
if incomplete_transmission:
self._log_info(
'Found an unsent content create record while creating record. '
'Including record.',
course_or_course_run_key=content_id
)
incomplete_transmission.mark_for_create()
items_to_create[content_id] = incomplete_transmission
else:
Expand Down Expand Up @@ -347,12 +342,6 @@ def _get_catalog_diff(
# if the item to create doesn't exist as an orphaned piece of content, do all the normal checks
elif content_key not in existing_content_keys:
unique_new_items_to_create.append(item)
else:
self._log_info(
'Found an previous content record in another catalog while creating. '
'Skipping record.',
course_or_course_run_key=content_key
)

content_to_create = self._check_matched_content_to_create(
enterprise_catalog,
Expand Down Expand Up @@ -443,11 +432,6 @@ def _get_customer_config_orphaned_content(self, max_set_count, content_key=None)

# Grab orphaned content metadata items for the customer, ordered by oldest to newest
orphaned_content = OrphanedContentTransmissions.objects.filter(base_query)
num_records = len(orphaned_content)
self._log_info(
f'Found {num_records} orphaned content records for customer: '
f'{self.enterprise_customer.uuid}. Returning {min(max_set_count, num_records)} records.'
)
ordered_and_chunked_orphaned_content = orphaned_content.order_by('created')[:max_set_count]
return ordered_and_chunked_orphaned_content

Expand All @@ -463,10 +447,6 @@ def _sanitize_and_set_item_metadata(self, item, metadata, action):
item.content_title = metadata.get('title')
item.content_last_changed = metadata.get('content_last_modified')
item.save()
self._log_info(
f'_sanitize_and_set_item_metadata method updated item: {item} `content_last_changed`: '
f'{metadata.get("content_last_modified")}'
)

def export(self, **kwargs):
"""
Expand Down Expand Up @@ -510,10 +490,6 @@ def export(self, **kwargs):
max_payload_count
)

self._log_info(f'diff items_to_create: {items_to_create}')
self._log_info(f'diff items_to_update: {items_to_update}')
self._log_info(f'diff items_to_delete: {items_to_delete}')

content_keys_filter = list(items_to_create.keys()) + list(items_to_update.keys())
if content_keys_filter:
content_metadata_items = self.enterprise_catalog_api.get_content_metadata(
Expand Down
18 changes: 0 additions & 18 deletions integrated_channels/integrated_channel/exporters/learner_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,25 +312,12 @@ def get_grades_summary(
else:
completed_date_from_api, grade_from_api, is_passing_from_api, grade_percent, passed_timestamp = \
self.collect_certificate_data(enterprise_enrollment, channel_name)
LOGGER.info(generate_formatted_log(
channel_name, enterprise_customer_uuid, lms_user_id, course_id,
f'collect_certificate_data finished with CompletedDate: {completed_date_from_api},'
f' Grade: {grade_from_api}, IsPassing: {is_passing_from_api},'
f' Passed timestamp: {passed_timestamp}'
))
if completed_date_from_api is None:
# means we cannot find a cert for this learner
# we will try getting grades info using the alternative api in this case
# if that also does not exist then we have nothing to report
completed_date_from_api, grade_from_api, is_passing_from_api, grade_percent, passed_timestamp = \
self.collect_grades_data(enterprise_enrollment, course_details, channel_name)
LOGGER.info(generate_formatted_log(
channel_name, enterprise_customer_uuid, lms_user_id, course_id,
f'No certificate found, obtained grading data from grades api.'
f' CompletedDate: {completed_date_from_api},'
f' Grade: {grade_from_api}, IsPassing: {is_passing_from_api},'
f' Passed timestamp: {passed_timestamp}'
))

# In the past we have been inconsistent about the format/source/typing of the grade_percent value.
# Initial investigations have lead us to believe that grade percents from the source are seemingly more
Expand Down Expand Up @@ -369,11 +356,6 @@ def get_incomplete_content_count(self, enterprise_enrollment, channel_name):
user = User.objects.get(pk=lms_user_id)
completion_summary = get_completion_summary(course_id, user)
incomplete_count = completion_summary.get('incomplete_count')
LOGGER.info(
generate_formatted_log(
channel_name, enterprise_customer_uuid, lms_user_id, course_id,
f'Incomplete count for audit enrollment is {incomplete_count}'
))

return incomplete_count

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,10 @@ def transmit(self, create_payload, update_payload, delete_payload):
Transmit content metadata items to the integrated channel. Save or update content metadata records according to
the type of transmission.
"""
self._log_info_for_each_item_map(delete_payload, 'transmitting delete')
delete_payload_results = self._transmit_delete(delete_payload)

self._log_info_for_each_item_map(create_payload, 'transmitting create')
create_payload_results = self._transmit_create(create_payload)

self._log_info_for_each_item_map(update_payload, 'transmitting update')
update_payload_results = self._transmit_update(update_payload)
return create_payload_results, update_payload_results, delete_payload_results

Expand Down Expand Up @@ -220,11 +217,6 @@ def _transmit_action(self, content_metadata_item_map, client_method, action_name
finally:
action_happened_at = localized_utcnow()
for content_id, transmission in chunk.items():
self._log_info(
f'integrated_channel_content_transmission_id={transmission.id}, '
f'saving {action_name} transmission',
course_or_course_run_key=content_id
)
transmission.api_response_status_code = response_status_code
was_successful = response_status_code < 300
api_content_response = response_body
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,6 @@ def transmit(self, payload, **kwargs): # pylint: disable=arguments-differ
# one by course key and one by course run id.
# If the transmission with the course key succeeds, the next one will get skipped.
# If it fails, the one with the course run id will be attempted and (presumably) succeed.
LOGGER.info(generate_formatted_log(
self.enterprise_configuration.channel_code(),
enterprise_customer_uuid,
None,
None,
f"Looping through learner data = {payload.export(**kwargs)}"
))

for learner_data in payload.export(**kwargs):
serialized_payload = learner_data.serialize(enterprise_configuration=self.enterprise_configuration)
Expand All @@ -313,15 +306,6 @@ def transmit(self, payload, **kwargs): # pylint: disable=arguments-differ
# The user has not completed the course, so we shouldn't send a completion status call
remote_id = getattr(learner_data, kwargs.get('remote_user_id'))
encoded_serialized_payload = encode_data_for_logging(serialized_payload)
LOGGER.info(generate_formatted_log(
self.enterprise_configuration.channel_code(),
enterprise_customer_uuid,
lms_user_id,
learner_data.course_id,
'Skipping in-progress enterprise enrollment record '
f'integrated_channel_remote_user_id={remote_id}, '
f'integrated_channel_serialized_payload_base64={encoded_serialized_payload}'
))
continue

grade = getattr(learner_data, 'grade', None)
Expand All @@ -333,14 +317,6 @@ def transmit(self, payload, **kwargs): # pylint: disable=arguments-differ
detect_grade_updated=self.INCLUDE_GRADE_FOR_COMPLETION_AUDIT_CHECK,
):
# We've already sent a completion status for this enrollment
LOGGER.info(generate_formatted_log(
self.enterprise_configuration.channel_code(),
enterprise_customer_uuid,
lms_user_id,
learner_data.course_id,
'Skipping previously sent enterprise enrollment '
f'integrated_channel_enterprise_enrollment_id={enterprise_enrollment_id}'
))
continue

if self.enterprise_configuration.dry_run_mode_enabled:
Expand Down
10 changes: 0 additions & 10 deletions integrated_channels/moodle/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,16 +335,6 @@ def _wrapped_create_course_completion(self, user_id, payload):
'grades[0][grade]': completion_data['grade'] * self.enterprise_configuration.grade_scale
}

encoded_params = encode_data_for_logging(params)
LOGGER.info(generate_formatted_log(
self.enterprise_configuration.channel_code(),
self.enterprise_configuration.enterprise_customer.uuid,
user_id,
course_id,
'posting learner data to integrated channel '
f'integrated_channel_params_base64={encoded_params}'
))

return self._post(params)

def create_content_metadata(self, serialized_data):
Expand Down
11 changes: 0 additions & 11 deletions integrated_channels/sap_success_factors/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,17 +405,6 @@ def _call_search_students_recursively(self, sap_search_student_url, all_inactive
new_page_start_at = page_size + start_at
total_inactive_learners = sap_inactive_learners['@odata.count']
inactive_learners_on_page = sap_inactive_learners['value']
LOGGER.info(
generate_formatted_log(
self.enterprise_configuration.channel_code(),
self.enterprise_configuration.enterprise_customer.uuid,
None,
None,
f"SAP SF searchStudent API returned {len(inactive_learners_on_page)} "
f"inactive learners of total {total_inactive_learners} starting from {start_at} for "
f"enterprise customer {self.enterprise_configuration.enterprise_customer.name}"
)
)

all_inactive_learners += inactive_learners_on_page
if total_inactive_learners > new_page_start_at:
Expand Down
11 changes: 0 additions & 11 deletions integrated_channels/sap_success_factors/exporters/learner_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,6 @@ def unlink_learners(self):
sap_student_id = sap_inactive_learner['studentID']
social_auth_user = get_user_from_social_auth(providers, sap_student_id, enterprise_customer)
if not social_auth_user:
LOGGER.info(
generate_formatted_log(
self.enterprise_configuration.channel_code(),
self.enterprise_configuration.enterprise_customer.uuid,
None,
None,
f"No social auth data found for inactive user with SAP student id {sap_student_id} "
f"of enterprise customer {enterprise_customer.name} with identity providers "
f"{', '.join(map(lambda provider: provider.provider_id, providers))}"
)
)
continue

try:
Expand Down

0 comments on commit ad64859

Please sign in to comment.