Better debug info

This commit is contained in:
Scott Idem
2024-03-29 13:14:35 -04:00
parent 257edec1a7
commit 8c3786947e
4 changed files with 8 additions and 10 deletions

View File

@@ -67,6 +67,8 @@ def load_data_store_obj_w_code(
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
log.info(f'Getting Data Store record with code: {code} for Account ID: {account_id} and For Type: {for_type} and For ID: {for_id}')
data = {}
data['account_id'] = account_id
data['code'] = code
@@ -87,7 +89,6 @@ def load_data_store_obj_w_code(
sql_limit = sql_limit_offset_part(limit=limit, offset=offset) # Reasonably safe return str
log.debug(data)
# log.warning(f'Where are we now??????????? {code}')
sql = f"""
SELECT *
@@ -106,10 +107,12 @@ def load_data_store_obj_w_code(
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(sql)
if data_store_rec_li_result := sql_select(data=data, sql=sql, as_list=True):
data_store_rec_li = data_store_rec_li_result
else: # [] or False
data_store_rec_li = data_store_rec_li_result
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(data_store_rec_li_result)
@@ -126,14 +129,9 @@ def load_data_store_obj_w_code(
log.debug(data_store_obj)
else: pass
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.info(f'Found {len(data_store_obj_li)} Data Store records with code: {code} for Account ID: {account_id} and For Type: {for_type} and For ID: {for_id}')
log.debug(data_store_obj_li)
return data_store_obj_li
# if model_as_dict:
# return data_store_obj.dict(by_alias=by_alias, exclude_unset=exclude_unset) # pylint: disable=no-member
# else:
# return data_store_obj
# ### END ### API Data Store Methods ### load_data_store_obj_w_code() ###