Skip to content

Commit d6a4451

Browse files
committed
chore: reduce the log level of go service log forwarding to git integration
Signed-off-by: anil <epipav@gmail.com>
1 parent 1b1ecbd commit d6a4451

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

services/apps/git_integration/src/crowdgit/services/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ async def run_shell_command(
169169
timeout: float | None = None,
170170
input_text: str | bytes | None = None,
171171
stderr_logger: logging.Logger | None = None,
172+
stderr_log_level: str = "INFO",
172173
) -> str:
173174
"""
174175
Run shell command asynchronously and return output on success, raise exception on failure.
@@ -179,6 +180,7 @@ async def run_shell_command(
179180
timeout: Command timeout in seconds
180181
input_text: Text (str) or bytes to send to stdin (will automatically append newline if not present)
181182
stderr_logger: If provided, a logger whose .info() method is called with each stderr line in real-time
183+
stderr_log_level: Log level for stderr lines (default: "INFO")
182184
183185
Returns:
184186
str: Command stdout output
@@ -230,7 +232,7 @@ async def _stream() -> None:
230232
async for raw_line in process.stderr:
231233
line = _safe_decode(raw_line).rstrip()
232234
if line:
233-
stderr_logger.info(line)
235+
stderr_logger.log(stderr_log_level, line)
234236
stderr_lines.append(line)
235237

236238
stdout, _ = await asyncio.gather(process.stdout.read(), _stream())

services/apps/git_integration/src/crowdgit/services/vulnerability_scanner/vulnerability_scanner_service.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ async def run(self, repo_id: str, repo_path: str, repo_url: str) -> None:
3636
output = await run_shell_command(
3737
[self.vulnerability_scanner_executable, repo_path, repo_url],
3838
stderr_logger=self.logger,
39+
stderr_log_level="DEBUG",
3940
)
4041
except Exception as e:
4142
self.logger.warning(f"Scanner failed for {repo_url}: {e}")
@@ -54,6 +55,7 @@ async def run(self, repo_id: str, repo_path: str, repo_url: str) -> None:
5455
"--no-transitive",
5556
],
5657
stderr_logger=self.logger,
58+
stderr_log_level="DEBUG",
5759
)
5860
except Exception as retry_err:
5961
self.logger.error(f"Retry also failed for {repo_url}: {retry_err}")
@@ -68,7 +70,7 @@ async def run(self, repo_id: str, repo_path: str, repo_url: str) -> None:
6870
output = None
6971

7072
if output is not None:
71-
self.logger.info(f"Vulnerability scanner output: {output}")
73+
self.logger.debug(f"Vulnerability scanner output: {output}")
7274
try:
7375
json_output = json.loads(output)
7476
except json.JSONDecodeError as e:

0 commit comments

Comments
 (0)