feat: summarize information from debug logs#632
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This comment has been minimized.
This comment has been minimized.
8282568 to
1eafd1c
Compare
80bc9f4 to
01b2ac8
Compare
PR Reviewer Guide 🔍
|
| for _, h := range summary.Highlights { | ||
| fmt.Fprintf(&sb, " L%d [%s] %s\n", h.Line, h.Kind, h.Message) | ||
| } |
There was a problem hiding this comment.
is there any scenario where Line, Kind or Message would be empty / not present?
There was a problem hiding this comment.
I think not, Line is always i+1 ≥ 1; Kind is always one of the four constants set by classify; and classify("") returns false, so empty/whitespace messages never become highlights.
| func isTableRow(msg string) bool { | ||
| return msg != "" && (msg[0] == ' ' || msg[0] == '\t' || tableRowRe.MatchString(msg)) | ||
| } |
There was a problem hiding this comment.
this seems very hacky, not sure if there are better ways of doing this
There was a problem hiding this comment.
Agreed, I'll follow-up on it
| func headerSpan(msgs []string) span { | ||
| start := -1 | ||
| for i, msg := range msgs { | ||
| if strings.HasPrefix(msg, "Version:") { | ||
| start = i | ||
| break | ||
| } | ||
| } | ||
| if start < 0 { | ||
| return span{-1, -1} | ||
| } | ||
| end := start | ||
| for i := start + 1; i < len(msgs) && isTableRow(msgs[i]); i++ { | ||
| end = i | ||
| } | ||
| return span{start, end} | ||
| } |
There was a problem hiding this comment.
I'm thinking if is possible to work with templates instead of doing these manipulations... Have you considered those / had impediments regarding them?
There was a problem hiding this comment.
Not quite sure, what kind of templates did you have in mind?
Templates that we have in GAF (for our presenter) are better for rendering: if we used templates for rendering the CLI header/footer then I think it could be a bit more viable, but for matching the current log header/footer section I don't think it would make much sense.
|
@CatalinSnyk also, bot left some comments that might be relevant: |
|

Description
Checklist
make test)make generate)make lint)