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

status: remove extra empty line logging #107

Merged
merged 1 commit into from
May 23, 2023

Conversation

subhamkrai
Copy link
Collaborator

@subhamkrai subhamkrai commented May 22, 2023

status: remove extra empty line logging

changing Info() method to print Info and
logs with new line only when output is not empty
otherwise it will print Info: with empty line.

fixes: #102

for _, cr := range allCRs {
logging.Info(cr)
command := fmt.Sprintf(scriptPrintSpecificCRStatus, clusterNamespace, cr)
logging.Info(exec.ExecuteBashCommand(command))
Copy link
Member

Choose a reason for hiding this comment

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

The logging.Info() is printing "Info:" with no other info for other commands besides the example given in the issue. Instead of changing the implementation here, try just change inside the logging.Info() method to only print a blank line if there is no message.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

should be good now

pkg/rook/status.go Show resolved Hide resolved
changing Info() method to print `Info` and
logs with new line only when output is not empty
otherwise it will print `Info:` with empty line.

Signed-off-by: subhamkrai <srai@redhat.com>
@subhamkrai subhamkrai force-pushed the fix-adding-empty-log branch from ce1b160 to df1ab8b Compare May 22, 2023 15:18
if output != "" {
fmt.Print(blue("Info: "))
fmt.Printf(output, args...)
}
Copy link
Member

Choose a reason for hiding this comment

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

I think a blank line will still be helpful if it's blank

Suggested change
}
} else {
fmt.Println()
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

there is already new line

blue := color.New(color.FgBlue).SprintFunc()
if output != "" {
fmt.Print(blue("Info: "))
fmt.Printf(output, args...)
}
fmt.Println()

Copy link
Member

Choose a reason for hiding this comment

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

oh right, I overlooked it, thanks

@subhamkrai subhamkrai requested a review from travisn May 23, 2023 03:06
if output != "" {
fmt.Print(blue("Info: "))
fmt.Printf(output, args...)
}
Copy link
Member

Choose a reason for hiding this comment

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

oh right, I overlooked it, thanks

@subhamkrai subhamkrai merged commit ad5c057 into rook:master May 23, 2023
@subhamkrai subhamkrai deleted the fix-adding-empty-log branch May 23, 2023 11:59
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.

Blank info lines should not print "Info:"
2 participants