mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Change log facility.
This commit is contained in:
parent
3f6cb3cd73
commit
1ef163f827
26 changed files with 2746 additions and 135 deletions
|
|
@ -35,10 +35,6 @@
|
|||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.3" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net35" />
|
||||
<package id="WindowsInput" version="0.2.0.0" targetFramework="net35" />
|
||||
</packages>
|
||||
|
|
@ -35,10 +35,6 @@
|
|||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.3" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net35" />
|
||||
</packages>
|
||||
|
|
@ -35,10 +35,6 @@
|
|||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net">
|
||||
<HintPath>..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.3" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net35" />
|
||||
</packages>
|
||||
|
|
@ -35,10 +35,6 @@
|
|||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
|
|
@ -90,7 +86,6 @@
|
|||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="plugin.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.3" targetFramework="net35" />
|
||||
</packages>
|
||||
|
|
@ -35,10 +35,6 @@
|
|||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.3" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net35" />
|
||||
</packages>
|
||||
|
|
@ -37,7 +37,7 @@ namespace Wox.Core.Plugin
|
|||
return;
|
||||
}
|
||||
|
||||
string pluginFolerPath = PluginManager.DefaultPluginDirectory;
|
||||
string pluginFolerPath = PluginManager.PluginDirectory;
|
||||
|
||||
string newPluginName = plugin.Name
|
||||
.Replace("/", "_")
|
||||
|
|
|
|||
|
|
@ -30,35 +30,17 @@ namespace Wox.Core.Plugin
|
|||
private static List<string> pluginDirectories = new List<string>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Default plugin directory
|
||||
/// new plugin will be installed to this directory
|
||||
/// </summary>
|
||||
public static string DefaultPluginDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
string userProfilePath = Environment.GetEnvironmentVariable("USERPROFILE");
|
||||
if (string.IsNullOrEmpty(userProfilePath))
|
||||
{
|
||||
throw new WoxCritialException("Wox Can't Find Environment Variable UserProfile");
|
||||
}
|
||||
|
||||
return Path.Combine(Path.Combine(userProfilePath, ".Wox"), "Plugins");
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetupPluginDirectories()
|
||||
{
|
||||
pluginDirectories.Clear();
|
||||
|
||||
pluginDirectories.Add(DefaultPluginDirectory);
|
||||
pluginDirectories.Add(
|
||||
Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Plugins"));
|
||||
|
||||
pluginDirectories.Add(PluginDirectory);
|
||||
MakesurePluginDirectoriesExist();
|
||||
}
|
||||
|
||||
public static string PluginDirectory
|
||||
{
|
||||
get { return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Plugins"); }
|
||||
}
|
||||
|
||||
private static void MakesurePluginDirectoriesExist()
|
||||
{
|
||||
foreach (string pluginDirectory in pluginDirectories)
|
||||
|
|
|
|||
|
|
@ -19,13 +19,6 @@ namespace Wox.Core.Theme
|
|||
static Theme()
|
||||
{
|
||||
themeDirectories.Add(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Themes"));
|
||||
|
||||
string userProfilePath = Environment.GetEnvironmentVariable("USERPROFILE");
|
||||
if (userProfilePath != null)
|
||||
{
|
||||
themeDirectories.Add(Path.Combine(Path.Combine(userProfilePath, ".Wox"), "Themes"));
|
||||
}
|
||||
|
||||
MakesureThemeDirectoriesExist();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,10 +35,6 @@
|
|||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
|
|
@ -95,9 +91,6 @@
|
|||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.3" targetFramework="net35" />
|
||||
</packages>
|
||||
|
|
@ -1,41 +1,41 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using NLog;
|
||||
|
||||
namespace Wox.Infrastructure.Logger
|
||||
{
|
||||
public class Log
|
||||
{
|
||||
private static ILog fileLogger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static NLog.Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public static void Error(string msg)
|
||||
{
|
||||
fileLogger.Error(msg);
|
||||
logger.Error(msg);
|
||||
}
|
||||
|
||||
public static void Error(Exception e)
|
||||
{
|
||||
fileLogger.Error(e.Message + "\r\n" + e.StackTrace);
|
||||
logger.Error(e.Message + "\r\n" + e.StackTrace);
|
||||
}
|
||||
|
||||
public static void Debug(string msg)
|
||||
{
|
||||
fileLogger.Debug(msg);
|
||||
logger.Debug(msg);
|
||||
}
|
||||
|
||||
public static void Info(string msg)
|
||||
{
|
||||
fileLogger.Info(msg);
|
||||
logger.Info(msg);
|
||||
}
|
||||
|
||||
public static void Warn(string msg)
|
||||
{
|
||||
fileLogger.Warn(msg);
|
||||
logger.Warn(msg);
|
||||
}
|
||||
|
||||
public static void Fatal(string msg)
|
||||
{
|
||||
fileLogger.Fatal(msg);
|
||||
logger.Fatal(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2694
Wox.Infrastructure/Logger/NLog.xsd
Normal file
2694
Wox.Infrastructure/Logger/NLog.xsd
Normal file
File diff suppressed because it is too large
Load diff
25
Wox.Infrastructure/NLog.config
Normal file
25
Wox.Infrastructure/NLog.config
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
You can use http://www.legitlog.com/ to visualize those logs
|
||||
-->
|
||||
<!-- log level
|
||||
Trace - very detailed logs, which may include high-volume information such as protocol payloads. This log level is typically only enabled during development
|
||||
Debug - debugging information, less detailed than trace, typically not enabled in production environment.
|
||||
Info - information messages, which are normally enabled in production environment
|
||||
Warn - warning messages, typically for non-critical issues, which can be recovered or which are temporary failures
|
||||
Error - error messages
|
||||
Fatal - very serious errors-->
|
||||
<targets>
|
||||
<target xsi:type="File" name="file" fileName="${basedir}/logs/${shortdate}.log"/>
|
||||
<target xsi:type="Console" name="console" />
|
||||
</targets>
|
||||
<rules>
|
||||
<logger name="*" minlevel="Warn" writeTo="file" />
|
||||
<logger name="*" minlevel="Debug" writeTo="console" />
|
||||
</rules>
|
||||
</nlog>
|
||||
|
|
@ -33,5 +33,4 @@ using System.Runtime.InteropServices;
|
|||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
@ -37,15 +37,14 @@
|
|||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net">
|
||||
<HintPath>..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog">
|
||||
<HintPath>..\packages\NLog.3.2.0.0\lib\net35\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
|
|
@ -84,6 +83,12 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="NLog.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="Logger\NLog.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.3" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net35" />
|
||||
<package id="NLog" version="3.2.0.0" targetFramework="net35" />
|
||||
</packages>
|
||||
|
|
@ -1,30 +1,5 @@
|
|||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="System.Configuration.IgnoreSectionHandler"/>
|
||||
</configSections>
|
||||
<log4net>
|
||||
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
|
||||
<file type="log4net.Util.PatternString">
|
||||
<converter>
|
||||
<name value="WoxLogPathConverter"/>
|
||||
<type value="Wox.Helper.WoxLogPathConverter,Wox"/>
|
||||
</converter>
|
||||
<conversionPattern value="%WoxLogPathConverter{log}\\log.txt"/>
|
||||
</file>
|
||||
<appendToFile value="true"/>
|
||||
<rollingStyle value="Date"/>
|
||||
<datePattern value="yyyyMMdd-HH:mm:ss"/>
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="Date:%date Level:%-5level Msg:%message%newline"/>
|
||||
</layout>
|
||||
</appender>
|
||||
<root>
|
||||
<!-- ALL < DEBUG < INFO < WARN < ERROR < FATAL < OFF-->
|
||||
<level value="WARN"/>
|
||||
<appender-ref ref="LogFileAppender"/>
|
||||
</root>
|
||||
</log4net>
|
||||
<runtime>
|
||||
<!--http://stackoverflow.com/questions/186854/how-to-prevent-an-exception-in-a-background-thread-from-terminating-an-application-->
|
||||
<!--prevent non-ui exception crash wox-->
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Wox.Helper
|
||||
{
|
||||
public class WoxLogPathConverter : log4net.Util.PatternConverter
|
||||
{
|
||||
protected override void Convert(TextWriter writer, object state)
|
||||
{
|
||||
string userProfilePath = Environment.GetEnvironmentVariable("USERPROFILE");
|
||||
writer.Write(Path.Combine(userProfilePath, ".Wox"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -34,6 +34,7 @@ using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
|||
using MenuItem = System.Windows.Forms.MenuItem;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
using ToolTip = System.Windows.Controls.ToolTip;
|
||||
using Wox.Infrastructure.Logger;
|
||||
|
||||
namespace Wox
|
||||
{
|
||||
|
|
|
|||
|
|
@ -66,10 +66,6 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
|
|
@ -115,7 +111,6 @@
|
|||
<Compile Include="Converters\OpacityModeConverter.cs" />
|
||||
<Compile Include="Converters\StringEmptyConverter.cs" />
|
||||
<Compile Include="Converters\StringNullOrEmptyToVisibilityConverter.cs" />
|
||||
<Compile Include="Helper\WoxLogPathConverter.cs" />
|
||||
<Compile Include="ImageLoader\ImageCacheStroage.cs" />
|
||||
<Compile Include="Storage\UserSelectedRecordStorage.cs" />
|
||||
<Compile Include="Update\NewVersionWindow.xaml.cs">
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="InputSimulator" version="1.0.4.0" targetFramework="net35" />
|
||||
<package id="log4net" version="2.0.3" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net35" />
|
||||
<package id="NHotkey" version="1.2.1" targetFramework="net35" />
|
||||
<package id="NHotkey.Wpf" version="1.2.1" targetFramework="net35" />
|
||||
|
|
|
|||
Loading…
Reference in a new issue