Skip to content

Hook into the server on_stdout and on_stderr to log server logs#20

Merged
tomgeorge merged 2 commits into
editor-code-assistant:mainfrom
tomgeorge:fix/server-logs
Aug 8, 2025
Merged

Hook into the server on_stdout and on_stderr to log server logs#20
tomgeorge merged 2 commits into
editor-code-assistant:mainfrom
tomgeorge:fix/server-logs

Conversation

@tomgeorge

Copy link
Copy Markdown
Member

This is still a little clunky but I think it is valuable to get the server logs as well as client-side logs

This is still a little clunky but I think it is valuable to get the server logs as well as client-side logs
@tomgeorge tomgeorge marked this pull request as ready for review August 6, 2025 16:02
@tomgeorge tomgeorge requested a review from W3ND31 August 6, 2025 17:42
Comment thread lua/eca/server.lua Outdated
local output = table.concat(data, "\n")
if output and output ~= "" and output ~= "\n" then
Logger.debug("Processing stdout: " .. output)
Logger.log(output, vim.log.levels.INFO, { server = true })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In my opinion, the Logger should accept a { prefix = "Server" } option instead of { server = true } boolean. The logger would then know how to format the prefix to [SERVER]. I think the logger shouldn't need to know what a server is; it should know how to format prefixes. Also, booleans can only grow in number as more prefixes are added.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah this is a better idea. The more I think about it the more I think we should just pass stdout and stderr straight through without worrying about prefixing or saying "this is a client log and that is a server log". The logs are different looking anyways.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The more I think about it the more I think we should just pass stdout and stderr straight through without worrying about prefixing or saying "this is a client log and that is a server log". The logs are different looking anyways.

Exactly, TBH I don't know why you need a client log... eca-emacs and eca-vscode only log server logs (stderr) and that's enough for debugging

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hum log what client is sending/receiving is a nice to have, but not sure we need that now, other editors don't have

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think having client logs are useful 🤷 There is a lot of lua code for these bigger plugins

@tomgeorge

Copy link
Copy Markdown
Member Author

Also removed opts, I think I kept that in as a hold-over. You can still pass opts to Logger.notify to set things like title.

@tomgeorge tomgeorge merged commit beed598 into editor-code-assistant:main Aug 8, 2025
3 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.

3 participants