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

Add headers to output when using logs tail #732

Merged
merged 2 commits into from
Apr 13, 2023
Merged

Add headers to output when using logs tail #732

merged 2 commits into from
Apr 13, 2023

Conversation

sergiught
Copy link
Contributor

@sergiught sergiught commented Apr 12, 2023

🔧 Changes

Adds header to the table output for logs tail command as requested in #474.

📚 References

🔬 Testing

Screen.Recording.2023-04-12.at.18.23.38.mov

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

Comment on lines +153 to +157
truncate("TYPE", 23),
truncate("DESCRIPTION", 54),
truncate("DATE", 20),
truncate("CONNECTION", 20),
truncate("CLIENT", 20),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These values are coming from:

func (v *logView) AsTableRow() []string {
typ, desc := v.typeDesc()
clientName := v.GetClientName()
if clientName == "" {
clientName = ansi.Faint(notApplicable)
}
conn := v.getConnection()
if conn == notApplicable {
conn = ansi.Faint(truncate(conn, 20))
} else {
conn = truncate(conn, 20)
}
return []string{
typ,
truncate(desc, 54),
truncate(v.GetDate().Format("Jan 02 15:04:05.000"), 20),
conn,
clientName,
}
}
.

Was not able to reuse the ViewAsTableHeader func due to the extra empty spaces needed to align everything.

@sergiught sergiught marked this pull request as ready for review April 12, 2023 16:34
@sergiught sergiught requested a review from a team as a code owner April 12, 2023 16:34
@sergiught sergiught merged commit c311de4 into main Apr 13, 2023
@sergiught sergiught deleted the patch/logs branch April 13, 2023 08:13
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