From 1ef163f827ff65ba7e21207f094f1c52470110e7 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Tue, 20 Jan 2015 22:33:45 +0800 Subject: [PATCH] Change log facility. --- Plugins/Wox.Plugin.CMD/Wox.Plugin.CMD.csproj | 4 - Plugins/Wox.Plugin.CMD/packages.config | 1 - .../Wox.Plugin.Folder.csproj | 4 - Plugins/Wox.Plugin.Folder/packages.config | 1 - .../Wox.Plugin.Program.csproj | 4 - Plugins/Wox.Plugin.Program/packages.config | 1 - Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj | 5 - Plugins/Wox.Plugin.Sys/packages.config | 4 - .../Wox.Plugin.WebSearch.csproj | 4 - Plugins/Wox.Plugin.WebSearch/packages.config | 1 - Wox.Core/Plugin/PluginInstaller.cs | 2 +- Wox.Core/Plugin/PluginManager.cs | 30 +- Wox.Core/Theme/Theme.cs | 7 - Wox.CrashReporter/Wox.CrashReporter.csproj | 7 - Wox.CrashReporter/packages.config | 4 - Wox.Infrastructure/Logger/Log.cs | 16 +- Wox.Infrastructure/Logger/NLog.xsd | 2694 +++++++++++++++++ Wox.Infrastructure/NLog.config | 25 + Wox.Infrastructure/Properties/AssemblyInfo.cs | 3 +- Wox.Infrastructure/Wox.Infrastructure.csproj | 13 +- Wox.Infrastructure/packages.config | 2 +- Wox/App.config | 25 - Wox/Helper/WoxLogPathConverter.cs | 17 - Wox/MainWindow.xaml.cs | 1 + Wox/Wox.csproj | 5 - Wox/packages.config | 1 - 26 files changed, 2746 insertions(+), 135 deletions(-) delete mode 100644 Plugins/Wox.Plugin.Sys/packages.config delete mode 100644 Wox.CrashReporter/packages.config create mode 100644 Wox.Infrastructure/Logger/NLog.xsd create mode 100644 Wox.Infrastructure/NLog.config delete mode 100644 Wox/Helper/WoxLogPathConverter.cs diff --git a/Plugins/Wox.Plugin.CMD/Wox.Plugin.CMD.csproj b/Plugins/Wox.Plugin.CMD/Wox.Plugin.CMD.csproj index bb495a5761..81bea53e1f 100644 --- a/Plugins/Wox.Plugin.CMD/Wox.Plugin.CMD.csproj +++ b/Plugins/Wox.Plugin.CMD/Wox.Plugin.CMD.csproj @@ -35,10 +35,6 @@ false - - False - ..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll - ..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll True diff --git a/Plugins/Wox.Plugin.CMD/packages.config b/Plugins/Wox.Plugin.CMD/packages.config index 9b94c8e082..5e64150e77 100644 --- a/Plugins/Wox.Plugin.CMD/packages.config +++ b/Plugins/Wox.Plugin.CMD/packages.config @@ -1,6 +1,5 @@  - \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Folder/Wox.Plugin.Folder.csproj b/Plugins/Wox.Plugin.Folder/Wox.Plugin.Folder.csproj index 3f7e303731..5551d5c2af 100644 --- a/Plugins/Wox.Plugin.Folder/Wox.Plugin.Folder.csproj +++ b/Plugins/Wox.Plugin.Folder/Wox.Plugin.Folder.csproj @@ -35,10 +35,6 @@ false - - False - ..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll - ..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll True diff --git a/Plugins/Wox.Plugin.Folder/packages.config b/Plugins/Wox.Plugin.Folder/packages.config index 8b4715c3c9..7a13476a54 100644 --- a/Plugins/Wox.Plugin.Folder/packages.config +++ b/Plugins/Wox.Plugin.Folder/packages.config @@ -1,5 +1,4 @@  - \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj index 62d515d85f..324b0fb103 100644 --- a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj +++ b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj @@ -35,10 +35,6 @@ false - - ..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll - True - False ..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll diff --git a/Plugins/Wox.Plugin.Program/packages.config b/Plugins/Wox.Plugin.Program/packages.config index 8b4715c3c9..7a13476a54 100644 --- a/Plugins/Wox.Plugin.Program/packages.config +++ b/Plugins/Wox.Plugin.Program/packages.config @@ -1,5 +1,4 @@  - \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj b/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj index 7a53c02944..271194ab0a 100644 --- a/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj +++ b/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj @@ -35,10 +35,6 @@ false - - False - ..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll - @@ -90,7 +86,6 @@ - PreserveNewest diff --git a/Plugins/Wox.Plugin.Sys/packages.config b/Plugins/Wox.Plugin.Sys/packages.config deleted file mode 100644 index 7eb67aa24b..0000000000 --- a/Plugins/Wox.Plugin.Sys/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj b/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj index a78368bfa1..ef331ba748 100644 --- a/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj +++ b/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj @@ -35,10 +35,6 @@ false - - False - ..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll - False ..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll diff --git a/Plugins/Wox.Plugin.WebSearch/packages.config b/Plugins/Wox.Plugin.WebSearch/packages.config index 8b4715c3c9..7a13476a54 100644 --- a/Plugins/Wox.Plugin.WebSearch/packages.config +++ b/Plugins/Wox.Plugin.WebSearch/packages.config @@ -1,5 +1,4 @@  - \ No newline at end of file diff --git a/Wox.Core/Plugin/PluginInstaller.cs b/Wox.Core/Plugin/PluginInstaller.cs index c6a53606ed..df9939aaf5 100644 --- a/Wox.Core/Plugin/PluginInstaller.cs +++ b/Wox.Core/Plugin/PluginInstaller.cs @@ -37,7 +37,7 @@ namespace Wox.Core.Plugin return; } - string pluginFolerPath = PluginManager.DefaultPluginDirectory; + string pluginFolerPath = PluginManager.PluginDirectory; string newPluginName = plugin.Name .Replace("/", "_") diff --git a/Wox.Core/Plugin/PluginManager.cs b/Wox.Core/Plugin/PluginManager.cs index 4ea7f5ebe8..dcb455c703 100644 --- a/Wox.Core/Plugin/PluginManager.cs +++ b/Wox.Core/Plugin/PluginManager.cs @@ -30,35 +30,17 @@ namespace Wox.Core.Plugin private static List pluginDirectories = new List(); - /// - /// Default plugin directory - /// new plugin will be installed to this directory - /// - 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) diff --git a/Wox.Core/Theme/Theme.cs b/Wox.Core/Theme/Theme.cs index 97dd656df1..78bea898d5 100644 --- a/Wox.Core/Theme/Theme.cs +++ b/Wox.Core/Theme/Theme.cs @@ -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(); } diff --git a/Wox.CrashReporter/Wox.CrashReporter.csproj b/Wox.CrashReporter/Wox.CrashReporter.csproj index beb211fdeb..565c82d816 100644 --- a/Wox.CrashReporter/Wox.CrashReporter.csproj +++ b/Wox.CrashReporter/Wox.CrashReporter.csproj @@ -35,10 +35,6 @@ false - - False - ..\packages\log4net.2.0.3\lib\net35-full\log4net.dll - @@ -95,9 +91,6 @@ PreserveNewest - - - diff --git a/Wox.CrashReporter/packages.config b/Wox.CrashReporter/packages.config deleted file mode 100644 index 7eb67aa24b..0000000000 --- a/Wox.CrashReporter/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Wox.Infrastructure/Logger/Log.cs b/Wox.Infrastructure/Logger/Log.cs index 52fd731764..8cfbc52bd5 100644 --- a/Wox.Infrastructure/Logger/Log.cs +++ b/Wox.Infrastructure/Logger/Log.cs @@ -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); } } } diff --git a/Wox.Infrastructure/Logger/NLog.xsd b/Wox.Infrastructure/Logger/NLog.xsd new file mode 100644 index 0000000000..481702860b --- /dev/null +++ b/Wox.Infrastructure/Logger/NLog.xsd @@ -0,0 +1,2694 @@ + + + + + + + + + + + + + + + Watch config file for changes and reload automatically. + + + + + Print internal NLog messages to the console. Default value is: false + + + + + Print internal NLog messages to the console error output. Default value is: false + + + + + Write internal NLog messages to the specified file. + + + + + Log level threshold for internal log messages. Default value is: Info. + + + + + Global log level threshold for application log messages. Messages below this level won't be logged.. + + + + + Pass NLog internal exceptions to the application. Default value is: false. + + + + + + + + + + + + + + Make all targets within this section asynchronous (creates additional threads but the calling thread isn't blocked by any target writes). + + + + + + + + + + + + + + + + + Prefix for targets/layout renderers/filters/conditions loaded from this assembly. + + + + + Load NLog extensions from the specified file (*.dll) + + + + + Load NLog extensions from the specified assembly. Assembly name should be fully qualified. + + + + + + + + + + Name of the logger. May include '*' character which acts like a wildcard. Allowed forms are: *, Name, *Name, Name* and *Name* + + + + + Comma separated list of levels that this rule matches. + + + + + Minimum level that this rule matches. + + + + + Maximum level that this rule matches. + + + + + Level that this rule matches. + + + + + Comma separated list of target names. + + + + + Ignore further rules if this one matches. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the file to be included. The name is relative to the name of the current config file. + + + + + Ignore any errors in the include file. + + + + + + + Variable name. + + + + + Variable value. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Maximum number of log events that the buffer can keep. + + + + + Number of log events to be buffered. + + + + + Indicates whether buffer should grow as needed. + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Indicates whether to add <!-- --> comments around all written texts. + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Number of log events that should be processed in a batch by the lazy writer thread. + + + + + Action to be taken when the lazy writer thread request queue count exceeds the set limit. + + + + + Limit on the number of requests in the lazy writer thread request queue. + + + + + Time in milliseconds to sleep between batches. + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + + + + + + + + + + + + + Name of the target. + + + + + Number of log events to be buffered. + + + + + Timeout (in milliseconds) after which the contents of buffer will be flushed if there's no write in the specified period of time. Use -1 to disable timed flushes. + + + + + Indicates whether to use sliding timeout. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Encoding to be used. + + + + + Instance of that is used to format log messages. + + + + + Maximum message size in bytes. + + + + + Indicates whether to append newline at the end of log message. + + + + + Action that should be taken if the message is larger than maxMessageSize. + + + + + Size of the connection cache (number of connections which are kept alive). + + + + + Network address. + + + + + Indicates whether to keep connection open whenever possible. + + + + + Maximum queue size. + + + + + Indicates whether to include NLog-specific extensions to log4j schema. + + + + + Indicates whether to include source info (file name and line number) in the information sent over the network. + + + + + NDC item separator. + + + + + Indicates whether to include call site (class and method name) in the information sent over the network. + + + + + AppInfo field. By default it's the friendly name of the current AppDomain. + + + + + Indicates whether to include stack contents. + + + + + Indicates whether to include dictionary contents. + + + + + + + + + + + + + + + + + + + + Layout that should be use to calcuate the value for the parameter. + + + + + Viewer parameter name. + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Text to be rendered. + + + + + Header. + + + + + Footer. + + + + + Indicates whether to use default row highlighting rules. + + + + + Indicates whether the error stream (stderr) should be used instead of the output stream (stdout). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Condition that must be met in order to set the specified foreground and background color. + + + + + Background color. + + + + + Foreground color. + + + + + + + + + + + + + + + Indicates whether to ignore case when comparing texts. + + + + + Regular expression to be matched. You must specify either text or regex. + + + + + Text to be matched. You must specify either text or regex. + + + + + Indicates whether to match whole words only. + + + + + Background color. + + + + + Foreground color. + + + + + + + + + + + + + + + + Name of the target. + + + + + Text to be rendered. + + + + + Header. + + + + + Footer. + + + + + Indicates whether to send the log messages to the standard error instead of the standard output. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Connection string. When provided, it overrides the values specified in DBHost, DBUserName, DBPassword, DBDatabase. + + + + + Name of the connection string (as specified in <connectionStrings> configuration section. + + + + + Database name. If the ConnectionString is not provided this value will be used to construct the "Database=" part of the connection string. + + + + + Database host name. If the ConnectionString is not provided this value will be used to construct the "Server=" part of the connection string. + + + + + Database password. If the ConnectionString is not provided this value will be used to construct the "Password=" part of the connection string. + + + + + Name of the database provider. + + + + + Database user name. If the ConnectionString is not provided this value will be used to construct the "User ID=" part of the connection string. + + + + + Indicates whether to keep the database connection open between the log events. + + + + + Indicates whether to use database transactions. Some data providers require this. + + + + + Connection string using for installation and uninstallation. If not provided, regular ConnectionString is being used. + + + + + Text of the SQL command to be run on each log level. + + + + + Type of the SQL command to be run on each log level. + + + + + + + + + + + + + + + + + + + + + + + Type of the command. + + + + + Connection string to run the command against. If not provided, connection string from the target is used. + + + + + Indicates whether to ignore failures. + + + + + Command text. + + + + + + + + + + + + + + Layout that should be use to calcuate the value for the parameter. + + + + + Database parameter name. + + + + + Database parameter precision. + + + + + Database parameter scale. + + + + + Database parameter size. + + + + + + + + + + + + + + + Name of the target. + + + + + Text to be rendered. + + + + + Header. + + + + + Footer. + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Layout that renders event Category. + + + + + Layout that renders event ID. + + + + + Name of the Event Log to write to. This can be System, Application or any user-defined name. + + + + + Name of the machine on which Event Log service is running. + + + + + Value to be used as the event Source. + + + + + + + + + + + + + + + Name of the target. + + + + + Indicates whether to return to the first target after any successful write. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Text to be rendered. + + + + + Header. + + + + + Footer. + + + + + File encoding. + + + + + Line ending mode. + + + + + Way file archives are numbered. + + + + + Name of the file to be used for an archive. + + + + + Indicates whether to automatically archive log files every time the specified time passes. + + + + + Size in bytes above which log files will be automatically archived. + + + + + Maximum number of archive files that should be kept. + + + + + Gets ors set a value indicating whether a managed file stream is forced, instead of used the native implementation. + + + + + File attributes (Windows only). + + + + + Indicates whether to replace file contents on each write instead of appending log message at the end. + + + + + Indicates whether to delete old log file on startup. + + + + + Name of the file to write to. + + + + + Value specifying the date format to use when archving files. + + + + + Indicates whether to archive old log file on startup. + + + + + Indicates whether to create directories if they don't exist. + + + + + Indicates whether to enable log file(s) to be deleted. + + + + + Maximum number of seconds that files are kept open. If this number is negative the files are not automatically closed after a period of inactivity. + + + + + Indicates whether concurrent writes to the log file by multiple processes on different network hosts. + + + + + Indicates whether to keep log file open instead of opening and closing it on each logging event. + + + + + Indicates whether concurrent writes to the log file by multiple processes on the same host. + + + + + Number of times the write is appended on the file before NLog discards the log message. + + + + + Delay in milliseconds to wait before attempting to write to the file again. + + + + + Log file buffer size in bytes. + + + + + Number of files to be kept open. Setting this to a higher value may improve performance in a situation where a single File target is writing to many files (such as splitting by level or by logger). + + + + + Indicates whether to automatically flush the file buffers after each log message. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Condition expression. Log events who meet this condition will be forwarded to the wrapped target. + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Indicates whether log text should be appended to the text of the control instead of overwriting it. + + + + + Name of control to which NLog will log write log text. + + + + + Name of the Form on which the control is located. + + + + + Whether new log entry are added to the start or the end of the control + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Windows domain name to change context to. + + + + + Required impersonation level. + + + + + Type of the logon provider. + + + + + Logon Type. + + + + + User account password. + + + + + Indicates whether to revert to the credentials of the process instead of impersonating another user. + + + + + Username to change context to. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Endpoint address. + + + + + Name of the endpoint configuration in WCF configuration file. + + + + + Client ID. + + + + + Indicates whether to include per-event properties in the payload sent to the server. + + + + + Indicates whether to use binary message encoding. + + + + + + + + + + + + + + Layout that should be use to calcuate the value for the parameter. + + + + + Name of the parameter. + + + + + Type of the parameter. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Text to be rendered. + + + + + Header. + + + + + Footer. + + + + + Indicates whether to send message as HTML instead of plain text. + + + + + Encoding to be used for sending e-mail. + + + + + Indicates whether to add new lines between log entries. + + + + + BCC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + Recipients' email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + CC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + Mail message body (repeated for each log message send in one mail). + + + + + Mail subject. + + + + + Sender's email address (e.g. joe@domain.com). + + + + + Indicates whether NewLine characters in the body should be replaced with tags. + + + + + Priority used for sending mails. + + + + + Indicates the SMTP client timeout. + + + + + SMTP Server to be used for sending. + + + + + SMTP Authentication mode. + + + + + Username used to connect to SMTP server (used when SmtpAuthentication is set to "basic"). + + + + + Password used to authenticate against SMTP server (used when SmtpAuthentication is set to "basic"). + + + + + Indicates whether SSL (secure sockets layer) should be used when communicating with SMTP server. + + + + + Port number that SMTP Server is listening on. + + + + + Indicates whether the default Settings from System.Net.MailSettings should be used. + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Message box title. + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Encoding to be used when writing text to the queue. + + + + + Indicates whether to use the XML format when serializing message. This will also disable creating queues. + + + + + Indicates whether to check if a queue exists before writing to it. + + + + + Indicates whether to create the queue if it doesn't exists. + + + + + Label to associate with each message. + + + + + Name of the queue to write to. + + + + + Indicates whether to use recoverable messages (with guaranteed delivery). + + + + + + + + + + + + + + + + + Name of the target. + + + + + Class name. + + + + + Method name. The method must be public and static. + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Encoding to be used. + + + + + Maximum message size in bytes. + + + + + Indicates whether to append newline at the end of log message. + + + + + Action that should be taken if the message is larger than maxMessageSize. + + + + + Network address. + + + + + Size of the connection cache (number of connections which are kept alive). + + + + + Indicates whether to keep connection open whenever possible. + + + + + Maximum queue size. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Encoding to be used. + + + + + Instance of that is used to format log messages. + + + + + Maximum message size in bytes. + + + + + Indicates whether to append newline at the end of log message. + + + + + Action that should be taken if the message is larger than maxMessageSize. + + + + + Size of the connection cache (number of connections which are kept alive). + + + + + Network address. + + + + + Indicates whether to keep connection open whenever possible. + + + + + Maximum queue size. + + + + + Indicates whether to include NLog-specific extensions to log4j schema. + + + + + Indicates whether to include source info (file name and line number) in the information sent over the network. + + + + + NDC item separator. + + + + + Indicates whether to include call site (class and method name) in the information sent over the network. + + + + + AppInfo field. By default it's the friendly name of the current AppDomain. + + + + + Indicates whether to include stack contents. + + + + + Indicates whether to include dictionary contents. + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Indicates whether to perform layout calculation. + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Indicates whether performance counter should be automatically created. + + + + + Name of the performance counter category. + + + + + Counter help text. + + + + + Name of the performance counter. + + + + + Performance counter type. + + + + + Performance counter instance name. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Default filter to be applied when no specific rule matches. + + + + + + + + + + + + + Condition to be tested. + + + + + Resulting filter to be applied when the condition matches. + + + + + + + + + + + + Name of the target. + + + + + + + + + + + + + + + Name of the target. + + + + + Number of times to repeat each log message. + + + + + + + + + + + + + + + + Name of the target. + + + + + Number of retries that should be attempted on the wrapped target in case of a failure. + + + + + Time to wait between retries in milliseconds. + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Indicates whether scroll bar will be moved automatically to show most recent log entries. + + + + + Name of RichTextBox to which Nlog will write. + + + + + Name of the Form on which the control is located. If there is no open form of a specified name than NLog will create a new one. + + + + + Initial height of the form with rich text box. + + + + + Maximum number of lines the rich text box will store (or 0 to disable this feature). + + + + + Indicates whether the created form will be initially minimized. + + + + + Indicates whether the created window will be a tool window. + + + + + Initial width of the form with rich text box. + + + + + Indicates whether to use default coloring rules. + + + + + + + + + + + + + + + + + + + + + + + + Condition that must be met in order to set the specified font color. + + + + + Background color. + + + + + Font color. + + + + + Font style of matched text. + + + + + + + + + + + + + + + + Indicates whether to ignore case when comparing texts. + + + + + Regular expression to be matched. You must specify either text or regex. + + + + + Text to be matched. You must specify either text or regex. + + + + + Indicates whether to match whole words only. + + + + + Background color. Names are identical with KnownColor enum extended with Empty value which means that background color won't be changed. + + + + + Font color. Names are identical with KnownColor enum extended with Empty value which means that font color won't be changed. + + + + + Font style of matched text. Possible values are the same as in FontStyle enum in System.Drawing. + + + + + + + + + + + + Name of the target. + + + + + + + + + + + + + + Name of the target. + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Encoding. + + + + + Web service method name. + + + + + Web service namespace. + + + + + Protocol to be used when calling web service. + + + + + Web service URL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Footer layout. + + + + + Header layout. + + + + + Body layout (can be repeated multiple times). + + + + + Custom column delimiter value (valid when ColumnDelimiter is set to 'Custom'). + + + + + Column delimiter. + + + + + Quote Character. + + + + + Quoting mode. + + + + + Indicates whether CVS should include header. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Layout of the column. + + + + + Name of the column. + + + + + + + + + + + + + + Footer layout. + + + + + Header layout. + + + + + Body layout (can be repeated multiple times). + + + + + + + + + + + + + + + + + + + + + Layout text. + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + Condition expression. + + + + + + + + + + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + Substring to be matched. + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + String to compare the layout to. + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + Substring to be matched. + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + String to compare the layout to. + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Wox.Infrastructure/NLog.config b/Wox.Infrastructure/NLog.config new file mode 100644 index 0000000000..ec19a82787 --- /dev/null +++ b/Wox.Infrastructure/NLog.config @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Wox.Infrastructure/Properties/AssemblyInfo.cs b/Wox.Infrastructure/Properties/AssemblyInfo.cs index cc1640d88f..b40c421669 100644 --- a/Wox.Infrastructure/Properties/AssemblyInfo.cs +++ b/Wox.Infrastructure/Properties/AssemblyInfo.cs @@ -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")] \ No newline at end of file diff --git a/Wox.Infrastructure/Wox.Infrastructure.csproj b/Wox.Infrastructure/Wox.Infrastructure.csproj index 1e897d3d26..ca13df96fb 100644 --- a/Wox.Infrastructure/Wox.Infrastructure.csproj +++ b/Wox.Infrastructure/Wox.Infrastructure.csproj @@ -37,15 +37,14 @@ false - - ..\packages\log4net.2.0.3\lib\net35-full\log4net.dll - True - False ..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll + + ..\packages\NLog.3.2.0.0\lib\net35\NLog.dll + @@ -84,6 +83,12 @@ + + Always + + + Designer + diff --git a/Wox.Infrastructure/packages.config b/Wox.Infrastructure/packages.config index 8b4715c3c9..59d02e4dd2 100644 --- a/Wox.Infrastructure/packages.config +++ b/Wox.Infrastructure/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Wox/App.config b/Wox/App.config index 2d597ab062..af328919aa 100644 --- a/Wox/App.config +++ b/Wox/App.config @@ -1,30 +1,5 @@ - -
- - - - - - - - - - - - - - - - - - - - - - - diff --git a/Wox/Helper/WoxLogPathConverter.cs b/Wox/Helper/WoxLogPathConverter.cs deleted file mode 100644 index 515916ad6f..0000000000 --- a/Wox/Helper/WoxLogPathConverter.cs +++ /dev/null @@ -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")); - } - } -} diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index 61151c9c4a..7a4cd03db1 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -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 { diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 3de730a3c6..7339787130 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -66,10 +66,6 @@ False ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll - - False - ..\packages\log4net.2.0.3\lib\net35-full\log4net.dll - False ..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll @@ -115,7 +111,6 @@ - diff --git a/Wox/packages.config b/Wox/packages.config index 5c9cf4a6fb..5e5610702f 100644 --- a/Wox/packages.config +++ b/Wox/packages.config @@ -1,7 +1,6 @@  -