mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 04:37:30 +02:00
close #47 Add log level config
This commit is contained in:
@@ -14,7 +14,12 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</appender>
|
</appender>
|
||||||
<root>
|
<root>
|
||||||
|
<!-- ALL < DEBUG < INFO < WARN < ERROR < FATAL < OFF-->
|
||||||
|
<level value="WARN" />
|
||||||
<appender-ref ref="LogFileAppender"/>
|
<appender-ref ref="LogFileAppender"/>
|
||||||
</root>
|
</root>
|
||||||
</log4net>
|
</log4net>
|
||||||
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
|
<startup>
|
||||||
|
<supportedRuntime version="v2.0.50727"/>
|
||||||
|
</startup>
|
||||||
|
</configuration>
|
||||||
|
|||||||
@@ -11,5 +11,25 @@ namespace Wox.Helper
|
|||||||
{
|
{
|
||||||
fileLogger.Error(msg);
|
fileLogger.Error(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Debug(string msg)
|
||||||
|
{
|
||||||
|
fileLogger.Debug(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Info(string msg)
|
||||||
|
{
|
||||||
|
fileLogger.Info(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Warn(string msg)
|
||||||
|
{
|
||||||
|
fileLogger.Warn(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Fatal(string msg)
|
||||||
|
{
|
||||||
|
fileLogger.Fatal(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace Wox
|
|||||||
|
|
||||||
globalHotkey.hookedKeyboardCallback += KListener_hookedKeyboardCallback;
|
globalHotkey.hookedKeyboardCallback += KListener_hookedKeyboardCallback;
|
||||||
|
|
||||||
this.Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing);
|
this.Closing += MainWindow_Closing;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||||
@@ -93,6 +93,8 @@ namespace Wox
|
|||||||
//DwmDropShadow.DropShadowToWindow(this);
|
//DwmDropShadow.DropShadowToWindow(this);
|
||||||
|
|
||||||
WindowIntelopHelper.DisableControlBox(this);
|
WindowIntelopHelper.DisableControlBox(this);
|
||||||
|
|
||||||
|
throw new Exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||||
@@ -100,11 +102,15 @@ namespace Wox
|
|||||||
if (!System.Diagnostics.Debugger.IsAttached)
|
if (!System.Diagnostics.Debugger.IsAttached)
|
||||||
{
|
{
|
||||||
string error = "Wox has an error that can't be handled. " + e.ExceptionObject;
|
string error = "Wox has an error that can't be handled. " + e.ExceptionObject;
|
||||||
Log.Error(error);
|
|
||||||
if (e.IsTerminating)
|
if (e.IsTerminating)
|
||||||
{
|
{
|
||||||
notifyIcon.Visible = false;
|
notifyIcon.Visible = false;
|
||||||
MessageBox.Show(error);
|
MessageBox.Show(error);
|
||||||
|
Log.Fatal(error);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log.Error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace Wox.PluginLoader
|
|||||||
|
|
||||||
if (!File.Exists(configPath))
|
if (!File.Exists(configPath))
|
||||||
{
|
{
|
||||||
Log.Error(string.Format("parse plugin {0} failed: didn't find config file.", configPath));
|
Log.Warn(string.Format("parse plugin {0} failed: didn't find config file.", configPath));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ namespace Wox.PluginLoader
|
|||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
string error = string.Format("Parse plugin config {0} failed: json format is not valid", configPath);
|
string error = string.Format("Parse plugin config {0} failed: json format is not valid", configPath);
|
||||||
Log.Error(error);
|
Log.Warn(error);
|
||||||
#if (DEBUG)
|
#if (DEBUG)
|
||||||
{
|
{
|
||||||
throw new WoxException(error);
|
throw new WoxException(error);
|
||||||
@@ -98,7 +98,7 @@ namespace Wox.PluginLoader
|
|||||||
{
|
{
|
||||||
string error = string.Format("Parse plugin config {0} failed: invalid language {1}", configPath,
|
string error = string.Format("Parse plugin config {0} failed: invalid language {1}", configPath,
|
||||||
metadata.Language);
|
metadata.Language);
|
||||||
Log.Error(error);
|
Log.Warn(error);
|
||||||
#if (DEBUG)
|
#if (DEBUG)
|
||||||
{
|
{
|
||||||
throw new WoxException(error);
|
throw new WoxException(error);
|
||||||
@@ -110,7 +110,7 @@ namespace Wox.PluginLoader
|
|||||||
{
|
{
|
||||||
string error = string.Format("Parse plugin config {0} failed: ExecuteFile {1} didn't exist", configPath,
|
string error = string.Format("Parse plugin config {0} failed: ExecuteFile {1} didn't exist", configPath,
|
||||||
metadata.ExecuteFilePath);
|
metadata.ExecuteFilePath);
|
||||||
Log.Error(error);
|
Log.Warn(error);
|
||||||
#if (DEBUG)
|
#if (DEBUG)
|
||||||
{
|
{
|
||||||
throw new WoxException(error);
|
throw new WoxException(error);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Wox.PluginLoader
|
|||||||
List<Type> types = asm.GetTypes().Where(o => o.IsClass && !o.IsAbstract && (o.BaseType == typeof(BaseSystemPlugin) || o.GetInterfaces().Contains(typeof(IPlugin)))).ToList();
|
List<Type> types = asm.GetTypes().Where(o => o.IsClass && !o.IsAbstract && (o.BaseType == typeof(BaseSystemPlugin) || o.GetInterfaces().Contains(typeof(IPlugin)))).ToList();
|
||||||
if (types.Count == 0)
|
if (types.Count == 0)
|
||||||
{
|
{
|
||||||
Log.Error(string.Format("Cound't load plugin {0}: didn't find the class who implement IPlugin",
|
Log.Warn(string.Format("Cound't load plugin {0}: didn't find the class who implement IPlugin",
|
||||||
metadata.Name));
|
metadata.Name));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Wox.PluginLoader
|
|||||||
PythonEngine.Shutdown();
|
PythonEngine.Shutdown();
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Log.Error("Could't find python environment, all python plugins disabled.");
|
Log.Warn("Could't find python environment, all python plugins disabled.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user