-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Logging improvements #1456
Logging improvements #1456
Conversation
@@ -536,25 +536,25 @@ internal void unshimOurselves() | |||
// directory are "dead" (i.e. already uninstalled, but not deleted), and | |||
// we blow them away. This is to make sure that we don't attempt to run | |||
// an uninstaller on an already-uninstalled version. | |||
async Task cleanDeadVersions(SemanticVersion originalVersion, SemanticVersion currentVersion, bool forceUninstall = false) | |||
async Task cleanDeadVersions(SemanticVersion currentVersion, SemanticVersion newVersion, bool forceUninstall = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a much better name, 👍
src/Squirrel/UpdaterIntention.cs
Outdated
@@ -0,0 +1,8 @@ | |||
namespace Squirrel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Squirrel doesn't use one-class-per-file, can you put this in IUpdateManager.cs (or maybe a different file, whatever makes Sense)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure thing
@@ -0,0 +1,85 @@ | |||
using Mono.Options; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Into this refactor 👍
Can you rebase against upstream master to get rid of the weird merge commits? (lemme know if this gives you Grief and I can help out) |
81d7365
to
08f71bf
Compare
Yeah, those commits refuse to go away. You are not on Electron HQ anymore |
08f71bf
to
4953432
Compare
Got it done. All feedback addressed so far. |
@bitdisaster Wait one more thing, this PR breaks a public interface, can we find a way to do this without the breaking change to |
🤔 |
I can't think of way to get totally rid of it because at the place where I need it, I have no other context on whether its an update or install scenario. However, we could make it virtually a non breaking change by moving the parameter to the end and apply a default value. |
Works for me, we don't promise ABI compatibility |
9c452ad
to
073fac7
Compare
073fac7
to
1516a3a
Compare
👍 |
This PR brings various improvements around logging with the main purpose of making them easier to understand for developer or CE engineers that do not have knowledge of the internals of Squirrel.
1.) Bugfix because of multiple process logging to the same file
With exemption of the
--uninstall
case logs get written to the location of the executing binary. During install and update scenarios theUpdate.exe
in%localappdate%\MyApp
can run in multiple process at the same time due to squirrel hooks. Previous code has tried to avoid collision but since the file was opened with ReadWrite access a collision would never happen. Instead partial or all content from one or the other process was missing. While the collision code is fixed and remains, a new naming strategy will also avoid collision (see 2.)2.) Better Squirrel log naming
Squirrel logs leaves logs in multiple locations depending on the executing binary's location. Furthermore, log file can contain information from multiples runs of different Squirrel commands such
--update
,--createShortcut
, etc. To make it easier to understand the content log files are now named by the invoked Squirrel command, e,gSquirrel-Update.log
,Squirrel-Uninstall.log
. The naming also avoids collision described in 1.)3.) No errors/ exceptions in happy path
Even if an installation or update went perfectly, the logs contained errors/exceptions. Without deeper knowledge of Squirrel its not easy to understand whether this is of any concern. From now on the logs will be nice and shiny if Squirrel walked the happy path.
4.) Clear end of logging session
When reading the log files its not clear whether a command such as
--install
was executed successful. It seems like a rather sudden stop. A final log entry at the end adds some peace of mind.5.) Add log level
While Squirrel uses log level internally they were not written to the log files. Now we will know if an entry is just and info or a warning or an error.