Skip to content

debug () call in external_command () should have a 'running: ' prefix#38

Open
sparimi-rh wants to merge 1 commit intolibguestfs:masterfrom
sparimi-rh:rhelmisc29419_sub
Open

debug () call in external_command () should have a 'running: ' prefix#38
sparimi-rh wants to merge 1 commit intolibguestfs:masterfrom
sparimi-rh:rhelmisc29419_sub

Conversation

@sparimi-rh
Copy link
Copy Markdown

This change adds prefix "virt-v2v: running:" to the Log statements generated by virt-v2v` tool when it invokes the external program.

Adding prefix to the generated log statements helps any external Log viewers to use the prefix in the framing the filter rules. For e.g. virt-v2v invokes openssl, nbdkit or nbdinfo or any other external programs, the prefix helps in filtering specific log statements.

Copy link
Copy Markdown
Collaborator

@crobinso crobinso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit message needs to be improved too. A title like mltools: improve command debug() output and then a body explaining this makes debug logs more clear where commands are originating

let external_command ?(echo_cmd = true) ?help cmd =
if echo_cmd then
debug "%s" cmd;
debug "%s: running: %s" !prog cmd;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after you adjust #37 like I suggested there, the !prog handling should be in the debug function itself, so drop it here.

In testing I noticed there are 2 other command running functions that need adjustment: shell_command like I mentioned elsewhere, and do_run. So since there are 3 call sites here I think we should instead embed the function name in the debug statement, which makes it easier to track down. so this case would be debug "external_command: %s" cmd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants