Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: server skips empty logs if SKIP_EMPTY_LOGS == 1 #157

Merged
merged 1 commit into from
Sep 25, 2024
Merged
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
6 changes: 4 additions & 2 deletions src/isolate/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from isolate.server.interface import from_grpc, to_grpc

EMPTY_MESSAGE_INTERVAL = float(os.getenv("ISOLATE_EMPTY_MESSAGE_INTERVAL", "600"))
SKIP_EMPTY_LOGS = os.getenv("ISOLATE_SKIP_EMPTY_LOGS") == "1"
MAX_GRPC_WAIT_TIMEOUT = float(os.getenv("ISOLATE_MAX_GRPC_WAIT_TIMEOUT", "10.0"))

# Whether to inherit all the packages from the current environment or not.
Expand Down Expand Up @@ -485,8 +486,9 @@ class LogHandler:
task: RunTask

def handle(self, log: Log) -> None:
self.task.logger.log(log.level, log.message, source=log.source)
self._add_log_to_queue(log)
if not SKIP_EMPTY_LOGS or log.message.strip():
self.task.logger.log(log.level, log.message, source=log.source)
self._add_log_to_queue(log)
mederka marked this conversation as resolved.
Show resolved Hide resolved

def _add_log_to_queue(self, log: Log) -> None:
grpc_log = cast(definitions.Log, to_grpc(log))
Expand Down
Loading