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

Log executed commands #691

Open
aikawayataro opened this issue Nov 12, 2024 · 6 comments
Open

Log executed commands #691

aikawayataro opened this issue Nov 12, 2024 · 6 comments
Assignees
Labels
suggestion We are still considering whether it is necessary to add this feature

Comments

@aikawayataro
Copy link
Contributor

I would like to see logging feature, especially logging of custom actions; there's no way to debug and see the output of the command
Git command logging should also be useful and may help with bug reports
For starters, a simple log to file will work (Serilog or NLog), but an in-app log viewer could be added later

@love-linger love-linger self-assigned this Nov 13, 2024
@love-linger love-linger added the suggestion We are still considering whether it is necessary to add this feature label Nov 13, 2024
@love-linger
Copy link
Collaborator

If a git command fails, SourceGit shows the output of it (except progress lines) as error message.

I'll consider how to handle and show logs of custom action.

@heartacker
Copy link
Contributor

Git 命令日志记录也应该很有用,

对于初学者可以学习,点击之后的命令。个人认为非常有用

@aikawayataro
Copy link
Contributor Author

If a git command fails, SourceGit shows the output of it (except progress lines) as error message.

This is true, but sometimes there is no error, but git fails in some way, like it was in #449, I believe logging will help to debug

I think simple file-based logging is enough, if you write them to logs/ inside the SourceGit data dir, the user can access them with "Open App Data Dir". The logs can be separated into custom-actions-YYYYYMMDD.log and git-YYYYMMDD.log.

对于初学者可以学习,点击之后的命令。个人认为非常有用

I'm not sure if this will be usable for newbies as some of the commands executed are very long and verbose. To make it really useful, something like "Git Console" needs to be added to show only "useful" commands. In my opinion, not some git command log with no descriptions, but the progit book (or any other of your choice) is a better study material 😁

@love-linger
Copy link
Collaborator

One of the questions I considered was when to delete the log files. After a period of accumulation, the log files may take up a lot of space. And this is hard for most users to notice.

The problem with #449 will not actually be solved by adding the log. The key reason of it is that the output of git diff is empty due to an external diff driver.

For custom actions, SourceGit currently captures the output of stderr, and if the action fails (e.g. the exit code of it is not 0), an error message will pop up.

@aikawayataro
Copy link
Contributor Author

One of the questions I considered was when to delete the log files. After a period of accumulation, the log files may take up a lot of space. And this is hard for most users to notice.

With serilog you can specify retainedFileCountLimit to keep last `N files (31 by default)

For custom actions, SourceGit currently captures the output of stderr, and if the action fails (e.g. the exit code of it is not 0), an error message will pop up.

stdout log would be useful anyway

@aikawayataro
Copy link
Contributor Author

Logging can also be beneficial for stuff like in #725, e.g. you can log response body on error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggestion We are still considering whether it is necessary to add this feature
Projects
None yet
Development

No branches or pull requests

3 participants