Use exc_info for error logging

This commit is contained in:
thePR0M3TH3AN
2025-07-01 18:23:44 -04:00
parent 1fec888bd5
commit f6a94d06cc
17 changed files with 149 additions and 193 deletions

View File

@@ -47,7 +47,6 @@ class EventHandler:
f"[New Event] ID: {evt.id} | Created At: {created_at_str} | Content: {evt.content}"
)
except Exception as e:
logger.error(f"Error handling new event: {e}")
logger.error(traceback.format_exc())
logger.error(f"Error handling new event: {e}", exc_info=True)
# Optionally, handle the exception without re-raising
# For example, continue processing other events

View File

@@ -47,8 +47,7 @@ class KeyManager:
logger.debug("Nostr Keys initialized successfully.")
except Exception as e:
logger.error(f"Key initialization failed: {e}")
logger.error(traceback.format_exc())
logger.error(f"Key initialization failed: {e}", exc_info=True)
raise
def initialize_bip85(self):
@@ -64,8 +63,7 @@ class KeyManager:
logger.debug("BIP85 initialized successfully.")
return bip85
except Exception as e:
logger.error(f"Failed to initialize BIP85: {e}")
logger.error(traceback.format_exc())
logger.error(f"Failed to initialize BIP85: {e}", exc_info=True)
raise
def generate_nostr_keys(self) -> Keys:
@@ -93,8 +91,7 @@ class KeyManager:
logger.debug(f"Nostr keys generated for fingerprint {self.fingerprint}.")
return keys
except Exception as e:
logger.error(f"Failed to generate Nostr keys: {e}")
logger.error(traceback.format_exc())
logger.error(f"Failed to generate Nostr keys: {e}", exc_info=True)
raise
def get_public_key_hex(self) -> str:
@@ -129,6 +126,5 @@ class KeyManager:
npub = bech32_encode("npub", data)
return npub
except Exception as e:
logger.error(f"Failed to generate npub: {e}")
logger.error(traceback.format_exc())
logger.error(f"Failed to generate npub: {e}", exc_info=True)
raise