mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 11:46:30 +02:00
Rewrite all log message format
This commit is contained in:
@@ -75,7 +75,7 @@ namespace Wox.Core.Plugin
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Exception(e);
|
||||
Log.Exception($"|Wox.Core.Plugin.JsonRPCPlugin.Query|Exception when query <{query}>", e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Wox.Core.Plugin
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Fatal(e);
|
||||
Log.Exception($"|PluginConfig.ParsePLuginConfigs|Can't delete <{directory}>", e);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -61,7 +61,7 @@ namespace Wox.Core.Plugin
|
||||
string configPath = Path.Combine(pluginDirectory, PluginConfigName);
|
||||
if (!File.Exists(configPath))
|
||||
{
|
||||
Log.Warn($"parse plugin {configPath} failed: didn't find config file.");
|
||||
Log.Error($"|PluginConfig.GetPluginMetadata|Didn't find config file <{configPath}>");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -77,23 +77,20 @@ namespace Wox.Core.Plugin
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
string msg = $"Parse plugin config {configPath} failed: json format is not valid";
|
||||
Log.Exception(new WoxException(msg));
|
||||
Log.Exception($"|PluginConfig.GetPluginMetadata|invalid json for config <{configPath}>", e);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (!AllowedLanguage.IsAllowed(metadata.Language))
|
||||
{
|
||||
string msg = $"Parse plugin config {configPath} failed: invalid language {metadata.Language}";
|
||||
Log.Exception(new WoxException(msg));
|
||||
Log.Error($"|PluginConfig.GetPluginMetadata|Invalid language <{metadata.Language}> for config <{configPath}>");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!File.Exists(metadata.ExecuteFilePath))
|
||||
{
|
||||
string msg = $"Parse plugin config {configPath} failed: ExecuteFile {metadata.ExecuteFilePath} didn't exist";
|
||||
Log.Exception(new WoxException(msg));
|
||||
Log.Error($"|PluginConfig.GetPluginMetadata|execute file path didn't exist <{metadata.ExecuteFilePath}> for conifg <{configPath}");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace Wox.Core.Plugin
|
||||
API = api;
|
||||
Parallel.ForEach(AllPlugins, pair =>
|
||||
{
|
||||
var milliseconds = Stopwatch.Debug($"Plugin init: {pair.Metadata.Name}", () =>
|
||||
var milliseconds = Stopwatch.Debug($"|PluginManager.InitializePlugins|Init method time cost for <{pair.Metadata.Name}>", () =>
|
||||
{
|
||||
pair.Plugin.Init(new PluginInitContext
|
||||
{
|
||||
@@ -102,7 +102,7 @@ namespace Wox.Core.Plugin
|
||||
});
|
||||
});
|
||||
pair.Metadata.InitTime += milliseconds;
|
||||
Log.Info($"Total init for {pair.Metadata.Name}: {pair.Metadata.InitTime}ms");
|
||||
Log.Info($"|PluginManager.InitializePlugins|Total init cost for <{pair.Metadata.Name}> is <{pair.Metadata.InitTime}ms>");
|
||||
InternationalizationManager.Instance.UpdatePluginMetadataTranslations(pair);
|
||||
});
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace Wox.Core.Plugin
|
||||
try
|
||||
{
|
||||
var metadata = pair.Metadata;
|
||||
var milliseconds = Stopwatch.Debug($"Plugin.Query cost for {metadata.Name}", () =>
|
||||
var milliseconds = Stopwatch.Debug($"|PluginManager.QueryForPlugin|Cost for {metadata.Name}", () =>
|
||||
{
|
||||
results = pair.Plugin.Query(query) ?? results;
|
||||
UpdatePluginMetadata(results, metadata, query);
|
||||
@@ -243,7 +243,7 @@ namespace Wox.Core.Plugin
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Exception(new WoxPluginException(metadata.Name, "Couldn't load plugin context menus", e));
|
||||
Log.Exception($"|PluginManager.GetContextMenusForPlugin|Can't load context menus for plugin <{metadata.Name}>", e);
|
||||
return new List<Result>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Wox.Core.Plugin
|
||||
|
||||
foreach (var metadata in metadatas)
|
||||
{
|
||||
var milliseconds = Stopwatch.Debug($"C# plugin constructor init: {metadata.Name}", () =>
|
||||
var milliseconds = Stopwatch.Debug($"|PluginsLoader.CSharpPlugins|Constructor init cost for {metadata.Name}", () =>
|
||||
{
|
||||
|
||||
#if DEBUG
|
||||
@@ -49,7 +49,7 @@ namespace Wox.Core.Plugin
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Exception(new WoxPluginException(metadata.Name, "Couldn't load assembly", e));
|
||||
Log.Exception($"|PluginsLoader.CSharpPlugins|Couldn't load assembly for {metadata.Name}", e);
|
||||
return;
|
||||
}
|
||||
var types = assembly.GetTypes();
|
||||
@@ -60,7 +60,7 @@ namespace Wox.Core.Plugin
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
Log.Exception(new WoxPluginException(metadata.Name, "Can't find class implement IPlugin", e));
|
||||
Log.Exception($"|PluginsLoader.CSharpPlugins|Can't find class implement IPlugin for <{metadata.Name}>", e);
|
||||
return;
|
||||
}
|
||||
IPlugin plugin;
|
||||
@@ -70,7 +70,7 @@ namespace Wox.Core.Plugin
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Exception(new WoxPluginException(metadata.Name, "Can't create instance", e));
|
||||
Log.Exception($"|PluginsLoader.CSharpPlugins|Can't create instance for <{metadata.Name}>", e);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -104,13 +104,13 @@ namespace Wox.Core.Plugin
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Exception(new WoxException("Python can't be found in PATH."));
|
||||
Log.Error("|PluginsLoader.PythonPlugins|Python can't be found in PATH.");
|
||||
return new List<PluginPair>();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Exception(new WoxException("Path variable is not set."));
|
||||
Log.Error("|PluginsLoader.PythonPlugins|PATH environment variable is not set.");
|
||||
return new List<PluginPair>();
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ namespace Wox.Core.Plugin
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Exception(new WoxException("Can't find python executable in python directory"));
|
||||
Log.Error("|PluginsLoader.PythonPlugins|Can't find python executable in <b ");
|
||||
return new List<PluginPair>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user