Skip to content
This repository was archived by the owner on Dec 21, 2024. It is now read-only.

fix: remove redundant exception and str checking #196

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/pythonjsonlogger/jsonlogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def default(self, obj):
elif istraceback(obj):
return "".join(traceback.format_tb(obj)).strip()

elif type(obj) == Exception or isinstance(obj, Exception) or type(obj) == type:
elif isinstance(obj, Exception):
return str(obj)

try:
Expand Down Expand Up @@ -222,7 +222,7 @@ def add_fields(
)

if self.timestamp:
key = self.timestamp if type(self.timestamp) == str else "timestamp"
key = self.timestamp if isinstance(self.timestamp, str) else "timestamp"
log_record[key] = datetime.fromtimestamp(record.created, tz=timezone.utc)

self._perform_rename_log_fields(log_record)
Expand Down