Skip to content

Commit

Permalink
Changes pubsub condition to use REDIS_ENDPOINT and adds more explicit…
Browse files Browse the repository at this point in the history
… traceback method.
  • Loading branch information
jrwils committed May 13, 2024
1 parent 14941bb commit 15a239c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion logger/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from logger.logger import PluginLogger
log = PluginLogger()
log = PluginLogger()
4 changes: 1 addition & 3 deletions logger/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

from pubsub.pubsub import Publisher

ENV = os.getenv("ENV")

class PubSubLogHandler(logging.Handler):
def __init__(self)-> None:
self.publisher = Publisher()
Expand All @@ -25,7 +23,7 @@ def __init__(self) -> None:
streaming_handler.setFormatter(formatter)
self.logger.addHandler(streaming_handler)

if ENV == "production":
if os.getenv("REDIS_ENDPOINT"):
pubsub_handler = PubSubLogHandler()
pubsub_handler.setFormatter(formatter)
self.logger.addHandler(pubsub_handler)
Expand Down
2 changes: 1 addition & 1 deletion plugin_runner/plugin_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async def HandleEvent(self, request: Event, context):
try:
effects = protocol_class(request).compute()
except Exception as e:
log.error(traceback.format_exc())
log.error(traceback.format_exception(e))
continue
effect_list += effects

Expand Down

0 comments on commit 15a239c

Please sign in to comment.