Skip to content

Conversation

@tstack
Copy link
Contributor

@tstack tstack commented Sep 30, 2025

Stack traces are not part of a log message format string, so we need to separate them out. This change adds a regex that is run over the body to pull out Python/Java backtraces. If a trace is detected, it is stored in the trace field of the LogDetails struct. The body field will then only contain the message body without the trace.

In order to support this, though, the CLI needed to be modified to handle multi-line messages. So, the binary now reads input line-by-line and checks if it matches the log format. If it does, it's considered the start of a new message. If the next line/EOF also matches the format, then we process the message. Otherwise, we add the line to the previous lines to be processed later.

Files:

  • Cargo.toml: Add colored_json to color the output and make it readable.
  • package.json: Make pnpm version less specific
  • debugAdapter.ts: Change "--end" to "--count"
  • lib.rs: Add more LogError variants. Separate a backtrace from the message body.
  • main.rs: More error checking/reporting. Process input line-by-line and support multi-line messages. Color JSON output to make it easier to read. Command argument changes:
    • Support multiple source directories
    • Change --end to --count to avoid issues with end being less than start or having to figure out whether it's inclusive/exclusive.

Stack traces are not part of a log message format string,
so we need to separate them out.  This change adds a
regex that is run over the body to pull out Python/Java
backtraces.  If a trace is detected, it is stored in the
`trace` field of the `LogDetails` struct.  The `body`
field will then only contain the message body without
the trace.

In order to support this, though, the CLI needed to be
modified to handle multi-line messages.  So, the binary
now reads input line-by-line and checks if it matches
the log format.  If it does, it's considered the start
of a new message.  If the next line/EOF also matches
the format, then we process the message.  Otherwise,
we add the line to the previous lines to be processed
later.

Files:
* Cargo.toml: Add colored_json to color the output and
  make it readable.
* package.json: Make pnpm version less specific
* debugAdapter.ts: Change "--end" to "--count"
* lib.rs: Add more LogError variants.  Separate a
  backtrace from the message body.
* main.rs: More error checking/reporting.  Process input
  line-by-line and support multi-line messages.
  Color JSON output to make it easier to read.
  Command argument changes:
  - Support multiple source directories
  - Change --end to --count to avoid issues with end
    being less than start or having to figure out
    whether it's inclusive/exclusive.
@ttiimm ttiimm merged commit f942610 into ttiimm:main Oct 1, 2025
7 checks passed
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