Skip to content

Commit

Permalink
🎨 manually review and move info logs to debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ff137 committed Aug 14, 2024
1 parent 52ba276 commit d9fbe2c
Show file tree
Hide file tree
Showing 22 changed files with 68 additions and 68 deletions.
6 changes: 3 additions & 3 deletions app/routes/admin/tenants.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async def create_tenant(
wallet_label = body.wallet_label
wallet_name = body.wallet_name or uuid4().hex

bound_logger.info("Assert that requested label is not used in trust registry")
bound_logger.debug("Assert that requested label is not used in trust registry")
try:
actor_name_exists = await assert_actor_name(wallet_label)
except TrustRegistryException as e:
Expand Down Expand Up @@ -98,7 +98,7 @@ async def create_tenant(
)
async with get_tenant_admin_controller(admin_auth) as admin_controller:
try:
bound_logger.info("Creating wallet")
bound_logger.debug("Creating wallet")
wallet_response = await handle_acapy_call(
logger=bound_logger,
acapy_call=admin_controller.multitenancy.create_wallet,
Expand All @@ -121,7 +121,7 @@ async def create_tenant(

try:
if roles:
bound_logger.info(
bound_logger.debug(
"Onboarding `{}` with requested roles: `{}`", wallet_label, roles
)
onboard_result = await onboard_tenant(
Expand Down
8 changes: 4 additions & 4 deletions app/routes/websocket_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async def websocket_endpoint(
group_id: str = group_id_query,
auth: AcaPyAuthVerified = Depends(websocket_auth),
):
logger.info("Received websocket request on group `{}`", group_id)
logger.debug("Received websocket request on group `{}`", group_id)
await handle_websocket(
websocket, group_id=group_id, wallet_id="", topic="", auth=auth
)
Expand All @@ -34,7 +34,7 @@ async def websocket_endpoint_wallet(
group_id: str = group_id_query,
auth: AcaPyAuthVerified = Depends(websocket_auth),
):
logger.info(
logger.debug(
"Received websocket request on group `{}` and wallet id `{}`",
group_id,
wallet_id,
Expand All @@ -51,7 +51,7 @@ async def websocket_endpoint_topic(
group_id: str = group_id_query,
auth: AcaPyAuthVerified = Depends(websocket_auth),
):
logger.info(
logger.debug(
"Received websocket request on group `{}` and topic `{}`", group_id, topic
)
await handle_websocket(
Expand All @@ -67,7 +67,7 @@ async def websocket_endpoint_wallet_topic(
group_id: str = group_id_query,
auth: AcaPyAuthVerified = Depends(websocket_auth),
):
logger.info(
logger.debug(
"Received websocket request for group `{}`, wallet id `{}`, and topic `{}`",
group_id,
wallet_id,
Expand Down
10 changes: 5 additions & 5 deletions app/services/acapy_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def get_taa(controller: AcaPyClient) -> Tuple[TAAInfo, str]:
taa: Tuple[TAAInfo, str]
The TAAInfo object, with the mechanism
"""
logger.info("Fetching TAA")
logger.debug("Fetching TAA")
taa_response = await handle_acapy_call(
logger=logger, acapy_call=controller.ledger.fetch_taa
)
Expand Down Expand Up @@ -64,7 +64,7 @@ async def accept_taa(
mechanism:
An optional mechanism to specify
"""
logger.bind(body=taa).info("Accepting TAA")
logger.bind(body=taa).debug("Accepting TAA")
request_body = TAAAccept(**taa.to_dict(), mechanism=mechanism)
try:
await handle_acapy_call(
Expand Down Expand Up @@ -99,7 +99,7 @@ async def get_did_endpoint(
the issuer's Verinym from the ledger
"""
bound_logger = logger.bind(body={"issuer_nym": issuer_nym})
bound_logger.info("Fetching DID endpoint")
bound_logger.debug("Fetching DID endpoint")

issuer_endpoint_response = await handle_acapy_call(
logger=logger, acapy_call=controller.ledger.get_did_endpoint, did=issuer_nym
Expand Down Expand Up @@ -176,12 +176,12 @@ async def schema_id_from_credential_definition_id(
bound_logger = logger.bind(
body={"credential_definition_id": credential_definition_id}
)
bound_logger.info("Getting schema id from credential definition id")
bound_logger.debug("Getting schema id from credential definition id")

# scrape schema id or sequence number from cred def id
tokens = credential_definition_id.split(":")
if len(tokens) == 8: # node protocol >= 1.4: cred def id has 5 or 8 tokens
bound_logger.info("Constructed schema id from credential definition.")
bound_logger.debug("Constructed schema id from credential definition.")
return ":".join(tokens[3:7]) # schema id spans 0-based positions 3-6

# get txn by sequence number, retrieve schema identifier components
Expand Down
8 changes: 4 additions & 4 deletions app/services/acapy_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def assert_public_did(aries_controller: AcaPyClient) -> str:
str: the public did formatted as fully qualified did
"""
# Assert the agent has a public did
logger.info("Fetching public DID")
logger.debug("Fetching public DID")
public_did = await handle_acapy_call(
logger=logger, acapy_call=aries_controller.wallet.get_public_did
)
Expand All @@ -46,7 +46,7 @@ async def create_did(
Returns:
DID: The created did
"""
logger.info("Creating local DID")
logger.debug("Creating local DID")

if did_create is None:
did_create = DIDCreate()
Expand Down Expand Up @@ -82,7 +82,7 @@ async def set_public_did(
Returns:
DID: the did
"""
logger.info("Setting public DID")
logger.debug("Setting public DID")
did_response = await handle_acapy_call(
logger=logger,
acapy_call=controller.wallet.set_public_did,
Expand Down Expand Up @@ -111,7 +111,7 @@ async def get_public_did(controller: AcaPyClient) -> DID:
Returns:
DID: the public did
"""
logger.info("Fetching public DID")
logger.debug("Fetching public DID")
did_response = await handle_acapy_call(
logger=logger, acapy_call=controller.wallet.get_public_did
)
Expand Down
2 changes: 1 addition & 1 deletion app/services/definitions/schema_publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ async def _handle_existing_schema(
raise CloudApiException(error_message, 409)

result = credential_schema_from_acapy(_schema.var_schema)
self._logger.info(
self._logger.debug(
"Schema already exists on ledger. Returning schema definition: `{}`.",
result,
)
Expand Down
2 changes: 1 addition & 1 deletion app/services/event_handling/websocket_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async def callback(data: str, topic: str) -> None:

@staticmethod
async def unsubscribe(uuid: str) -> None:
logger.info("Unsubscribing a client")
logger.debug("Unsubscribing a client")
client = WebsocketManager._clients[uuid]
await WebsocketManager.disconnect(client)
WebsocketManager._clients.pop(uuid)
Expand Down
4 changes: 2 additions & 2 deletions app/services/onboarding/issuer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def onboard_issuer(
issuer_label (str): alias for the issuer
"""
bound_logger = logger.bind(body={"issuer_wallet_id": issuer_wallet_id})
bound_logger.info("Onboarding issuer")
bound_logger.debug("Onboarding issuer")

try:
issuer_did = await acapy_wallet.get_public_did(controller=issuer_controller)
Expand Down Expand Up @@ -94,7 +94,7 @@ async def onboard_issuer_no_public_did(
issuer_did (DID): The issuer's DID after completing the onboarding process
"""
bound_logger = logger.bind(body={"issuer_wallet_id": issuer_wallet_id})
bound_logger.info("Onboarding issuer that has no public DID")
bound_logger.debug("Onboarding issuer that has no public DID")

try:
bound_logger.debug("Getting public DID for endorser")
Expand Down
10 changes: 5 additions & 5 deletions app/services/onboarding/tenants.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def handle_tenant_update(
update_request: UpdateTenantRequest,
) -> WalletRecord:
bound_logger = logger.bind(body={"wallet_id": wallet_id})
bound_logger.bind(body=update_request).info("Handling tenant update")
bound_logger.bind(body=update_request).debug("Handling tenant update")

new_roles = update_request.roles or []
new_label = update_request.wallet_label
Expand Down Expand Up @@ -94,7 +94,7 @@ async def handle_tenant_update(
wallet_id=wallet_id,
body=request_body,
)
bound_logger.info("Tenant update handled successfully.")
bound_logger.debug("Tenant update handled successfully.")
return wallet


Expand All @@ -108,7 +108,7 @@ async def onboard_tenant(
bound_logger = logger.bind(
body={"tenant_label": tenant_label, "roles": roles, "wallet_id": wallet_id}
)
bound_logger.bind(body=roles).info("Start onboarding tenant")
bound_logger.bind(body=roles).debug("Start onboarding tenant")

if "issuer" in roles:
bound_logger.debug("Tenant has 'issuer' role, onboarding as issuer")
Expand All @@ -122,7 +122,7 @@ async def onboard_tenant(
issuer_wallet_id=wallet_id,
issuer_label=tenant_label,
)
bound_logger.info("Onboarding as issuer completed successfully.")
bound_logger.debug("Onboarding as issuer completed successfully.")
return onboard_result

elif "verifier" in roles:
Expand All @@ -131,7 +131,7 @@ async def onboard_tenant(
onboard_result = await onboard_verifier(
verifier_label=tenant_label, verifier_controller=tenant_controller
)
bound_logger.info("Onboarding as verifier completed successfully.")
bound_logger.debug("Onboarding as verifier completed successfully.")
return onboard_result

bound_logger.error("Tenant request does not have valid role(s) for onboarding.")
Expand Down
2 changes: 1 addition & 1 deletion app/services/onboarding/verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ async def onboard_verifier(*, verifier_controller: AcaPyClient, verifier_label:
"Tried and failed to create invitation on their behalf."
)

bound_logger.info("Returning verifier onboard result.")
bound_logger.debug("Returning verifier onboard result.")
return OnboardResult(**onboarding_result)
20 changes: 10 additions & 10 deletions app/services/revocation_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async def get_active_revocation_registry_for_credential(
bound_logger = logger.bind(
body={"credential_definition_id": credential_definition_id}
)
bound_logger.info("Fetching activate revocation registry for a credential")
bound_logger.debug("Fetching activate revocation registry for a credential")

result = await handle_acapy_call(
logger=bound_logger,
Expand All @@ -62,7 +62,7 @@ async def get_active_revocation_registry_for_credential(
f"`{credential_definition_id}`."
)

bound_logger.info(
bound_logger.debug(
"Successfully retrieved revocation registry for credential definition."
)
return result.result
Expand Down Expand Up @@ -94,7 +94,7 @@ async def revoke_credential(
"auto_publish_to_ledger": auto_publish_to_ledger,
}
)
bound_logger.info("Revoking an issued credential")
bound_logger.debug("Revoking an issued credential")

request_body = handle_model_with_validation(
logger=bound_logger,
Expand Down Expand Up @@ -189,7 +189,7 @@ async def publish_pending_revocations(
return

endorse_transaction_id = result.txn.transaction_id
bound_logger.info(
bound_logger.debug(
"Successfully published pending revocations. Endorser transaction id: {}.",
endorse_transaction_id,
)
Expand All @@ -215,7 +215,7 @@ async def clear_pending_revocations(
"""
bound_logger = logger.bind(body=revocation_registry_credential_map)

bound_logger.info("Validating revocation registry ids")
bound_logger.debug("Validating revocation registry ids")
await validate_rev_reg_ids(
controller=controller,
revocation_registry_credential_map=revocation_registry_credential_map,
Expand Down Expand Up @@ -270,7 +270,7 @@ async def get_credential_revocation_record(
"revocation_registry_id": revocation_registry_id,
}
)
bound_logger.info("Fetching the revocation status for a credential exchange")
bound_logger.debug("Fetching the revocation status for a credential exchange")

try:
result = await handle_acapy_call(
Expand Down Expand Up @@ -314,7 +314,7 @@ async def get_credential_definition_id_from_exchange_id(
credential_definition_id (Optional[str]): The credential definition ID or None.
"""
bound_logger = logger.bind(body={"credential_exchange_id": credential_exchange_id})
bound_logger.info("Fetching credential definition id from exchange id")
bound_logger.debug("Fetching credential definition id from exchange id")

cred_ex_id = strip_protocol_prefix(credential_exchange_id)
try:
Expand All @@ -329,7 +329,7 @@ async def get_credential_definition_id_from_exchange_id(
"An Exception was caught while getting v1 record: '{}'", err1.detail
)
try:
bound_logger.info("Trying to get v2 records")
bound_logger.debug("Trying to get v2 records")

cred_ex_record = await handle_acapy_call(
logger=bound_logger,
Expand Down Expand Up @@ -359,7 +359,7 @@ async def get_credential_definition_id_from_exchange_id(
)
return

bound_logger.info(
bound_logger.debug(
"Successfully obtained cred definition id from the cred exchange id."
)
return credential_definition_id
Expand All @@ -386,7 +386,7 @@ async def validate_rev_reg_ids(
if not rev_reg_id_list:
return

bound_logger.info("Validating revocation registry ids")
bound_logger.debug("Validating revocation registry ids")

for rev_reg_id in rev_reg_id_list:
try:
Expand Down
12 changes: 6 additions & 6 deletions app/services/trust_registry/actors.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def register_actor(actor: Actor) -> None:
TrustRegistryException: If an error occurred while registering the schema
"""
bound_logger = logger.bind(body={"actor": actor})
bound_logger.info("Registering actor on trust registry")
bound_logger.debug("Registering actor on trust registry")
async with RichAsyncClient(raise_status_error=False) as client:
actor_response = await client.post(
f"{TRUST_REGISTRY_URL}/registry/actors", json=actor.model_dump()
Expand Down Expand Up @@ -87,7 +87,7 @@ async def fetch_all_actors() -> List[Actor]:
Returns:
List[Actor]: List of actors
"""
logger.info("Fetching all actors from trust registry")
logger.debug("Fetching all actors from trust registry")
async with RichAsyncClient(raise_status_error=False) as client:
actors_response = await client.get(f"{TRUST_REGISTRY_URL}/registry/actors")

Expand Down Expand Up @@ -125,7 +125,7 @@ async def fetch_actor_by_did(did: str) -> Optional[Actor]:
Actor: The actor with specified did.
"""
bound_logger = logger.bind(body={"did": did})
bound_logger.info("Fetching actor by DID from trust registry")
bound_logger.debug("Fetching actor by DID from trust registry")
async with RichAsyncClient(raise_status_error=False) as client:
actor_response = await client.get(
f"{TRUST_REGISTRY_URL}/registry/actors/did/{did}"
Expand Down Expand Up @@ -162,7 +162,7 @@ async def fetch_actor_by_id(actor_id: str) -> Optional[Actor]:
Actor: The actor with specified id.
"""
bound_logger = logger.bind(body={"actor_id": actor_id})
bound_logger.info("Fetching actor by ID from trust registry")
bound_logger.debug("Fetching actor by ID from trust registry")
async with RichAsyncClient(raise_status_error=False) as client:
actor_response = await client.get(
f"{TRUST_REGISTRY_URL}/registry/actors/{actor_id}"
Expand Down Expand Up @@ -199,7 +199,7 @@ async def fetch_actor_by_name(actor_name: str) -> Optional[Actor]:
Actor: The actor with specified name.
"""
bound_logger = logger.bind(body={"actor_id": actor_name})
bound_logger.info("Fetching actor by NAME from trust registry")
bound_logger.debug("Fetching actor by NAME from trust registry")
async with RichAsyncClient(raise_status_error=False) as client:
actor_response = await client.get(
f"{TRUST_REGISTRY_URL}/registry/actors/name/{actor_name}"
Expand Down Expand Up @@ -236,7 +236,7 @@ async def fetch_actors_with_role(role: TrustRegistryRole) -> List[Actor]:
List[Actor]: List of actors with specified role
"""
bound_logger = logger.bind(body={"role": role})
bound_logger.info("Fetching all actors with requested role from trust registry")
bound_logger.debug("Fetching all actors with requested role from trust registry")
async with RichAsyncClient(raise_status_error=False) as client:
actors_response = await client.get(f"{TRUST_REGISTRY_URL}/registry/actors")

Expand Down
6 changes: 3 additions & 3 deletions app/services/trust_registry/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async def register_schema(schema_id: str) -> None:
TrustRegistryException: If an error occurred while registering the schema
"""
bound_logger = logger.bind(body={"schema_id": schema_id})
bound_logger.info("Registering schema on trust registry")
bound_logger.debug("Registering schema on trust registry")
async with RichAsyncClient() as client:
try:
await client.post(
Expand Down Expand Up @@ -50,7 +50,7 @@ async def fetch_schemas() -> List[Schema]:
Returns:
A list of schemas
"""
logger.info("Fetching all schemas from trust registry")
logger.debug("Fetching all schemas from trust registry")
async with RichAsyncClient() as client:
try:
schemas_res = await client.get(f"{TRUST_REGISTRY_URL}/registry/schemas")
Expand Down Expand Up @@ -79,7 +79,7 @@ async def get_schema_by_id(schema_id: str) -> Optional[Schema]:
A schema
"""
bound_logger = logger.bind(body={"schema_id": schema_id})
bound_logger.info("Fetching schema from trust registry")
bound_logger.debug("Fetching schema from trust registry")

async with RichAsyncClient() as client:
try:
Expand Down
Loading

0 comments on commit d9fbe2c

Please sign in to comment.