Timestamp InfraScan CLI logs to show scan duration distribution#72
Open
Natan-gal wants to merge 3 commits into
Open
Timestamp InfraScan CLI logs to show scan duration distribution#72Natan-gal wants to merge 3 commits into
Natan-gal wants to merge 3 commits into
Conversation
Added a logging function to print messages with timestamps, enhancing the visibility of the scanning process. Updated the main function to utilize this logging for various stages of execution.
pgesek
reviewed
May 19, 2026
| from datetime import datetime | ||
|
|
||
|
|
||
| def log_with_timestamp(message: str) -> None: |
Collaborator
There was a problem hiding this comment.
Move this lower, so that it is next to other method definitions
| [2026-10-10 16:23:34] Starting scan... | ||
| """ | ||
| timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S") | ||
| print(f"[{timestamp}] {message}", flush=True) |
Collaborator
There was a problem hiding this comment.
Can we use logging for this? We configure logging below
| traceback.print_exc() | ||
| sys.exit(1) | ||
|
|
||
| if __name__ == "__main__": |
Collaborator
There was a problem hiding this comment.
This is why this doesn't run, you removed the main check
…odule, restore main check
Updated logging configuration to use INFO level and added timestamps to log messages. Replaced print statements with logger calls for error handling and notifications.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Added timestamped log messages to the InfraScan CLI to make it easier to see how long each major stage of the scan takes.
Changes
Added a
log_with_timestamp()helper that prefixes messages with the current timestamp in the format:Added timestamped logs for the following stages:
Purpose
InfraScan builds can take more than 20 minutes to complete. These timestamps make it possible to identify which parts of the process consume the most time.
Notes
External tool output (e.g. Docker Scout, Grype) is not modified, but the added timestamped logs provide clear boundaries around the major processing steps.