[PowerToys Run] Logging (#11378)

This commit is contained in:
Mykhailo Pylyp
2021-05-21 17:24:33 +03:00
committed by GitHub
parent 4a65aa3d0e
commit 50c6a1de8a
4 changed files with 32 additions and 8 deletions

View File

@@ -243,7 +243,7 @@ public:
if (run_non_elevated(action_runner_path, params, pidBuffer))
{
Logger::trace("Started PowerToys Run Process. PID {}", *pidBuffer);
Logger::trace("Started PowerToys Run Process");
m_enabled = true;
const int maxRetries = 80;
for (int retry = 0; retry < maxRetries; ++retry)

View File

@@ -42,6 +42,7 @@ namespace PowerLauncher
[STAThread]
public static void Main()
{
Log.Info($"Starting PowerToys Run with PID={Process.GetCurrentProcess().Id}", typeof(App));
if (SingleInstance<App>.InitializeAsFirstInstance(Unique))
{
using (var application = new App())
@@ -50,10 +51,15 @@ namespace PowerLauncher
application.Run();
}
}
else
{
Log.Info("There is already running PowerToys Run instance", typeof(App));
}
}
private void OnStartup(object sender, StartupEventArgs e)
{
Log.Info("On Startup.", GetType());
for (int i = 0; i + 1 < e.Args.Length; i++)
{
if (e.Args[i] == "-powerToysPid")
@@ -61,8 +67,10 @@ namespace PowerLauncher
int powerToysPid;
if (int.TryParse(e.Args[i + 1], out powerToysPid))
{
Log.Info($"Runner pid={powerToysPid}", GetType());
RunnerHelper.WaitForPowerToysRunner(powerToysPid, () =>
{
Log.Info($"Runner with pid={powerToysPid} exited. Exiting PowerToys Run", GetType());
try
{
Dispose();

View File

@@ -91,6 +91,7 @@
<ItemGroup>
<None Include="Resources.resx" />
</ItemGroup>
<Import Project="..\..\..\..\deps\spdlog.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" />