diff --git a/NzbDrone.Core.Test/Fixtures.cs b/NzbDrone.Core.Test/Fixtures.cs index 74bca0b8a..ec26a1b81 100644 --- a/NzbDrone.Core.Test/Fixtures.cs +++ b/NzbDrone.Core.Test/Fixtures.cs @@ -23,5 +23,11 @@ namespace NzbDrone.Core.Test } } + + [SetUp] + public void Setup() + { + Main.ConfigureNlog(); + } } } \ No newline at end of file diff --git a/NzbDrone.Core.Test/SeriesTest.cs b/NzbDrone.Core.Test/SeriesTest.cs index a9117f939..1815bc773 100644 --- a/NzbDrone.Core.Test/SeriesTest.cs +++ b/NzbDrone.Core.Test/SeriesTest.cs @@ -68,8 +68,47 @@ namespace NzbDrone.Core.Test moqData.Verify(c => c.Add(It.IsAny()), Times.Once()); } - [Test] + [Test] + [Row(0)] + [Row(1)] + [Row(2)] + [Row(3)] + public void register_series_with_match(int matchPosition) + { + TvdbSeries fakeSeries = Builder.CreateNew().With(f => f.SeriesName = "The Simpsons").Build(); + var fakeSearch = Builder.CreateListOfSize(4).Build(); + fakeSearch[matchPosition].Id = fakeSeries.Id; + fakeSearch[matchPosition].SeriesName = fakeSeries.SeriesName; + + + //Arrange + var moqData = new Mock(); + var moqTvdb = new Mock(); + + moqData.Setup(f => f.Exists(c => c.TvdbId == It.IsAny())).Returns(false); + + moqTvdb.Setup(f => f.SearchSeries(It.IsAny())).Returns(fakeSearch); + moqTvdb.Setup(f => f.GetSeries(fakeSeries.Id, It.IsAny())).Returns(fakeSeries); + + var kernel = new MockingKernel(); + kernel.Bind().ToConstant(moqData.Object); + kernel.Bind().ToConstant(moqTvdb.Object); + kernel.Bind().To(); + + + //Act + var seriesController = kernel.Get(); + seriesController.RegisterSeries(@"D:\TV Shows\The Simpsons"); + + //Assert + //Verify that the show was added to the database only once. + moqData.Verify(c => c.Add(It.Is(d => d.TvdbId == fakeSeries.Id)), Times.Once()); + } + + + + [Test] [Description("This test confirms that the tvdb id stored in the db is preserved rather than being replaced by an auto incrementing value")] public void tvdbid_is_preserved([RandomNumbers(Minimum = 100, Maximum = 999, Count = 1)] int tvdbId) { @@ -86,5 +125,26 @@ namespace NzbDrone.Core.Test Assert.IsNotEmpty(allSeries); Assert.AreEqual(tvdbId, allSeries.First().TvdbId); } + + [Test] + [Row(new object[] { "CAPITAL", "capital", true })] + [Row(new object[] { "Something!!", "Something", true })] + [Row(new object[] { "Simpsons 2000", "Simpsons", true })] + [Row(new object[] { "Simp222sons", "Simpsons", true })] + [Row(new object[] { "Simpsons", "The Simpsons", true })] + [Row(new object[] { "Law and order", "Law & order", true })] + [Row(new object[] { "xxAndxx", "xxxx", false })] + [Row(new object[] { "Andxx", "xx", false })] + [Row(new object[] { "xxAnd", "xx", false })] + [Row(new object[] { "Thexx", "xx", false })] + [Row(new object[] { "Thexx", "xx", false })] + [Row(new object[] { "xxThexx", "xxxxx", false })] + [Row(new object[] { "Simpsons The", "Simpsons", true })] + public void Name_match_test(string a, string b, bool match) + { + bool result = SeriesProvider.IsTitleMatch(a, b); + + Assert.AreEqual(match, result, "{0} , {1}", a, b); + } } } diff --git a/NzbDrone.Core/Libraries/NLog.Extended.dll b/NzbDrone.Core/Libraries/NLog.Extended.dll new file mode 100644 index 000000000..762a6a992 Binary files /dev/null and b/NzbDrone.Core/Libraries/NLog.Extended.dll differ diff --git a/NzbDrone.Core/Libraries/NLog.Extended.xml b/NzbDrone.Core/Libraries/NLog.Extended.xml new file mode 100644 index 000000000..3838cfbe7 --- /dev/null +++ b/NzbDrone.Core/Libraries/NLog.Extended.xml @@ -0,0 +1,432 @@ + + + + NLog.Extended + + + + + ASP.NET Application variable. + + + Use this layout renderer to insert the value of the specified variable stored + in the ASP.NET Application dictionary. + + + You can set the value of an ASP.NET Application variable by using the following code: + + + + Example usage of ${aspnet-application}: + + ${aspnet-application:variable=myvariable} - produces "123" + ${aspnet-application:variable=anothervariable} - produces "01/01/2006 00:00:00" + ${aspnet-application:variable=anothervariable:culture=pl-PL} - produces "2006-01-01 00:00:00" + ${aspnet-application:variable=myvariable:padding=5} - produces " 123" + ${aspnet-application:variable=myvariable:padding=-5} - produces "123 " + ${aspnet-application:variable=stringvariable:upperCase=true} - produces "AAA BBB" + + + + + + Renders the specified ASP.NET Application variable and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Gets or sets the variable name. + + + + + + ASP.NET Request variable. + + + Use this layout renderer to insert the value of the specified parameter of the + ASP.NET Request object. + + + Example usage of ${aspnet-request}: + + ${aspnet-request:item=v} + ${aspnet-request:querystring=v} + ${aspnet-request:form=v} + ${aspnet-request:cookie=v} + ${aspnet-request:serverVariable=v} + + + + + + Renders the specified ASP.NET Request variable and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Gets or sets the item name. The QueryString, Form, Cookies, or ServerVariables collection variables having the specified name are rendered. + + + + + + Gets or sets the QueryString variable to be rendered. + + + + + + Gets or sets the form variable to be rendered. + + + + + + Gets or sets the cookie to be rendered. + + + + + + Gets or sets the ServerVariables item to be rendered. + + + + + + ASP.NET Session ID. + + + + + Renders the ASP.NET Session ID appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + ASP.NET Session variable. + + + Use this layout renderer to insert the value of the specified variable stored + in the ASP.NET Session dictionary. + + + You can set the value of an ASP.NET Session variable by using the following code: + + + + Example usage of ${aspnet-session}: + + ${aspnet-session:variable=myvariable} - produces "123" + ${aspnet-session:variable=anothervariable} - produces "01/01/2006 00:00:00" + ${aspnet-session:variable=anothervariable:culture=pl-PL} - produces "2006-01-01 00:00:00" + ${aspnet-session:variable=myvariable:padding=5} - produces " 123" + ${aspnet-session:variable=myvariable:padding=-5} - produces "123 " + ${aspnet-session:variable=stringvariable:upperCase=true} - produces "AAA BBB" + + + + + + Renders the specified ASP.NET Session value and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Gets or sets the session variable name. + + + + + + ASP.NET User variable. + + + + + Renders the specified ASP.NET User.Identity.AuthenticationType variable and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + ASP.NET User variable. + + + + + Renders the specified ASP.NET User.Identity.Name variable and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Writes log messages to the ASP.NET trace. + + Documentation on NLog Wiki + + Log entries can then be viewed by navigating to http://server/path/Trace.axd. + + + + + Writes the specified logging event to the ASP.NET Trace facility. + If the log level is greater than or equal to it uses the + method, otherwise it uses + method. + + The logging event. + + + + Writes log message to the specified message queue handled by MSMQ. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ You can use a single target to write to multiple queues (similar to writing to multiple files with the File target). +

+ +

+ The above examples assume just one target and a single rule. + More configuration options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +
+
+ + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Writes the specified logging event to a queue specified in the Queue + parameter. + + The logging event. + + + + Prepares a message to be sent to the message queue. + + The log event to be used when calculating label and text to be written. + The message to be sent. + + You may override this method in inheriting classes + to provide services like encryption or message + authentication. + + + + + Gets or sets the name of the queue to write to. + + + To write to a private queue on a local machine use .\private$\QueueName. + For other available queue names, consult MSMQ documentation. + + + + + + Gets or sets the label to associate with each message. + + + By default no label is associated. + + + + + + Gets or sets a value indicating whether to create the queue if it doesn't exists. + + + + + + Gets or sets a value indicating whether to use recoverable messages (with guaranteed delivery). + + + + + + Gets or sets the encoding to be used when writing text to the queue. + + + + + + Gets or sets a value indicating whether to use the XML format when serializing message. + + + + + + Buffers log events for the duration of ASP.NET request and sends them down + to the wrapped target at the end of a request. + + Documentation on NLog Wiki + +

+ Typically this target is used in cooperation with PostFilteringTargetWrapper + to provide verbose logging for failing requests and normal or no logging for + successful requests. We need to make the decision of the final filtering rule + to apply after all logs for a page have been generated. +

+

+ To use this target, you need to add an entry in the httpModules section of + web.config: +

+ + + + + + + + + + ]]> + +
+ +

To set up the ASP.NET Buffering target wrapper configuration file, put + the following in web.nlog file in your web application directory (this assumes + that PostFilteringWrapper is used to provide the filtering and actual logs go to + a file). +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To configure the target programmatically, put the following + piece of code in your Application_OnStart() handler in Global.asax.cs + or some other place that gets executed at the very beginning of your code: +

+ +

+ Fully working C# project can be found in the Examples/Targets/Configuration API/ASPNetBufferingWrapper + directory along with usage instructions. +

+
+
+ + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The wrapped target. + + + + Initializes a new instance of the class. + + The wrapped target. + Size of the buffer. + + + + Initializes the target by hooking up the NLogHttpModule BeginRequest and EndRequest events. + + + + + Closes the target by flushing pending events in the buffer (if any). + + + + + Adds the specified log event to the buffer. + + The log event. + + + + Gets or sets the number of log events to be buffered. + + + + + + Gets or sets a value indicating whether buffer should grow as needed. + + A value of true if buffer should grow as needed; otherwise, false. + + Value of true causes the buffer to expand until is hit, + false causes the buffer to never expand and lose the earliest entries in case of overflow. + + + + + + Gets or sets the maximum number of log events that the buffer can keep. + + + + + + ASP.NET HttpModule that enables NLog to hook BeginRequest and EndRequest events easily. + + + + + Initializes the HttpModule. + + + ASP.NET application. + + + + + Disposes the module. + + + + + Event to be raised at the end of each HTTP Request. + + + + + Event to be raised at the beginning of each HTTP Request. + + +
+
diff --git a/NzbDrone.Core/Libraries/NLog.dll b/NzbDrone.Core/Libraries/NLog.dll index cd8e7d651..8a27b27f3 100644 Binary files a/NzbDrone.Core/Libraries/NLog.dll and b/NzbDrone.Core/Libraries/NLog.dll differ diff --git a/NzbDrone.Core/Libraries/NLog.pdb b/NzbDrone.Core/Libraries/NLog.pdb index ebfc192d5..a9996beef 100644 Binary files a/NzbDrone.Core/Libraries/NLog.pdb and b/NzbDrone.Core/Libraries/NLog.pdb differ diff --git a/NzbDrone.Core/Libraries/NLog.xml b/NzbDrone.Core/Libraries/NLog.xml index 4f7c291c9..cd0c12c15 100644 --- a/NzbDrone.Core/Libraries/NLog.xml +++ b/NzbDrone.Core/Libraries/NLog.xml @@ -4,6 +4,266 @@ NLog + + + NLog COM Interop logger implementation. + + + + + NLog COM Interop logger interface. + + + + + Writes the diagnostic message at the specified level. + + The log level. + A to be written. + + + + Writes the diagnostic message at the Trace level. + + A to be written. + + + + Writes the diagnostic message at the Debug level. + + A to be written. + + + + Writes the diagnostic message at the Info level. + + A to be written. + + + + Writes the diagnostic message at the Warn level. + + A to be written. + + + + Writes the diagnostic message at the Error level. + + A to be written. + + + + Writes the diagnostic message at the Fatal level. + + A to be written. + + + + Checks if the specified log level is enabled. + + The log level. + A value indicating whether the specified log level is enabled. + + + + Gets a value indicating whether the Trace level is enabled. + + + + + Gets a value indicating whether the Debug level is enabled. + + + + + Gets a value indicating whether the Info level is enabled. + + + + + Gets a value indicating whether the Warn level is enabled. + + + + + Gets a value indicating whether the Error level is enabled. + + + + + Gets a value indicating whether the Fatal level is enabled. + + + + + Gets or sets the logger name. + + + + + Writes the diagnostic message at the specified level. + + The log level. + A to be written. + + + + Writes the diagnostic message at the Trace level. + + A to be written. + + + + Writes the diagnostic message at the Debug level. + + A to be written. + + + + Writes the diagnostic message at the Info level. + + A to be written. + + + + Writes the diagnostic message at the Warn level. + + A to be written. + + + + Writes the diagnostic message at the Error level. + + A to be written. + + + + Writes the diagnostic message at the Fatal level. + + A to be written. + + + + Checks if the specified log level is enabled. + + The log level. + + A value indicating whether the specified log level is enabled. + + + + + Gets a value indicating whether the Trace level is enabled. + + + + + + Gets a value indicating whether the Debug level is enabled. + + + + + + Gets a value indicating whether the Info level is enabled. + + + + + + Gets a value indicating whether the Warn level is enabled. + + + + + + Gets a value indicating whether the Error level is enabled. + + + + + + Gets a value indicating whether the Fatal level is enabled. + + + + + + Gets or sets the logger name. + + + + + + NLog COM Interop LogManager implementation. + + + + + NLog COM Interop LogManager interface. + + + + + Loads NLog configuration from the specified file. + + The name of the file to load NLog configuration from. + + + + Creates the specified logger object and assigns a LoggerName to it. + + Logger name. + The new logger instance. + + + + Gets or sets a value indicating whether internal messages should be written to the console. + + + + + Gets or sets the name of the internal log file. + + + + + Gets or sets the name of the internal log level. + + + + + Creates the specified logger object and assigns a LoggerName to it. + + The name of the logger. + The new logger instance. + + + + Loads NLog configuration from the specified file. + + The name of the file to load NLog configuration from. + + + + Gets or sets a value indicating whether to log internal messages to the console. + + + A value of true if internal messages should be logged to the console; otherwise, false. + + + + + Gets or sets the name of the internal log level. + + + + + + Gets or sets the name of the internal log file. + + + Asynchronous continuation delegate - function invoked at the end of asynchronous @@ -445,6 +705,19 @@ The message. The inner exception. + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + The parameter is null. + + + The class name is null or is zero (0). + + Condition layout expression (represented by a string literal @@ -773,6 +1046,19 @@ The message. The inner exception. + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + The parameter is null. + + + The class name is null or is zero (0). + + Condition parser. Turns a string representation of condition expression @@ -1037,6 +1323,20 @@ Gets the XML element name. + + + NLog configuration section handler class for configuring NLog from App.config. + + + + + Creates a configuration section handler. + + Parent object. + Configuration context object. + Section XML node. + The created section handler object. + Provides registration information for named items (targets, layouts, layout renderers, etc.) managed by NLog. @@ -1274,6 +1574,11 @@ Provides context for install/uninstall operations. + + + Mapping between log levels and console output colors. + + Initializes a new instance of the class. @@ -1484,6 +1789,30 @@ The new configuration. + + + Arguments for . + + + + + Initializes a new instance of the class. + + Whether configuration reload has succeeded. + The exception during configuration reload. + + + + Gets a value indicating whether configuration reload has succeeded. + + A value of true if succeeded; otherwise, false. + + + + Gets the exception which occurred during configuration reload. + + The exception. + Represents a logging rule. An equivalent of <logger /> configuration element. @@ -1784,6 +2113,19 @@ Provides simple programmatic configuration API used for trivial logging cases. + + + Configures NLog for console logging so that all messages above and including + the level are output to the console. + + + + + Configures NLog for console logging so that all messages above and including + the specified level are output to the console. + + The minimal logging level. + Configures NLog for to log to the specified target so that all messages @@ -1908,6 +2250,12 @@ Name of the file that contains the element (to be used as a base for including other files). Ignore any errors during configuration. + + + Gets the default object by parsing + the application configuration file (app.exe.config). + + Gets or sets a value indicating whether the configuration files @@ -2235,9 +2583,9 @@ Clears the content of the GDC. - + - Helpers for .NET Compact Framework. + Various helper methods for accessing state of ASP application. @@ -2491,6 +2839,11 @@ The enumerable. List of elements. + + + Safe way to get environment variables. + + Helper class for dealing with exceptions. @@ -2667,6 +3020,67 @@ Interface that provides parameters for create file function. + + + Provides a multiprocess-safe atomic file appends while + keeping the files open. + + + On Unix you can get all the appends to be atomic, even when multiple + processes are trying to write to the same file, because setting the file + pointer to the end of the file and appending can be made one operation. + On Win32 we need to maintain some synchronization between processes + (global named mutex is used for this) + + + + + Initializes a new instance of the class. + + Name of the file. + The parameters. + + + + Writes the specified bytes. + + The bytes to be written. + + + + Closes this instance. + + + + + Flushes this instance. + + + + + Gets the file info. + + The last write time. + Length of the file. + + True if the operation succeeded, false otherwise. + + + + + Factory class. + + + + + Opens the appender for given file name and parameters. + + Name of the file. + Creation parameters. + + Instance of which can be used to write to the file. + + Multi-process and multi-host file appender which attempts @@ -2794,6 +3208,50 @@ Length of the file. A value of true if file information was retrieved successfully, false otherwise. + + + Form helper methods. + + + + + Creates RichTextBox and docks in parentForm. + + Name of RichTextBox. + Form to dock RichTextBox. + Created RichTextBox. + + + + Finds control embedded on searchControl. + + Name of the control. + Control in which we're searching for control. + A value of null if no control has been found. + + + + Finds control of specified type embended on searchControl. + + The type of the control. + Name of the control. + Control in which we're searching for control. + + A value of null if no control has been found. + + + + + Creates a form. + + Name of form. + Width of form. + Height of form. + Auto show form. + If set to true the form will be minimized. + If set to true the form will be created as tool window. + Created form. + Interface implemented by layouts and layout renderers. @@ -2806,6 +3264,11 @@ The log event. String representation of a layout. + + + Supports mocking of SMTP Client code. + + Supports object initialization and termination. @@ -2832,22 +3295,6 @@ Gets the level of stack trace information required by the implementing class. - - - Define Localizable attribute for platforms that don't have it. - - - - - Initializes a new instance of the class. - - Determines whether the target is localizable. - - - - Gets or sets a value indicating whether the target is localizable. - - Logger configuration. @@ -2875,6 +3322,88 @@ A value of true if the specified level is enabled; otherwise, false. + + + Watches multiple files at the same time and raises an event whenever + a single change is detected in any of those files. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Stops the watching. + + + + + Watches the specified files for changes. + + The file names. + + + + Occurs when a change is detected in one of the monitored files. + + + + + Supports mocking of SMTP Client code. + + + + + Sends a QUIT message to the SMTP server, gracefully ends the TCP connection, and releases all resources used by the current instance of the class. + + + + + Supports mocking of SMTP Client code. + + + + + Supports mocking of SMTP Client code. + + + + + Supports mocking of SMTP Client code. + + + + + Supports mocking of SMTP Client code. + + + + + Supports mocking of SMTP Client code. + + + + + Supports mocking of SMTP Client code. + + + + + Supports mocking of SMTP Client code. + + + + + Supports mocking of SMTP Client code. + + + + + Supports mocking of SMTP Client code. + + Creates instances of objects for given URLs. @@ -3005,16 +3534,6 @@ A newly created network sender. - - - Emulate missing functionality from .NET Compact Framework - - - - - Emulate missing functionality from .NET Compact Framework - - Socket proxy for mocking Socket code. @@ -3033,25 +3552,25 @@ Closes the wrapped socket. - + Invokes ConnectAsync method on the wrapped socket. - The instance containing the event data. + The instance containing the event data. Result of original method. - + Invokes SendAsync method on the wrapped socket. - The instance containing the event data. + The instance containing the event data. Result of original method. - + Invokes SendToAsync method on the wrapped socket. - The instance containing the event data. + The instance containing the event data. Result of original method. @@ -3109,7 +3628,7 @@ - Facilitates mocking of class. + Facilitates mocking of class. @@ -3209,6 +3728,82 @@ A value of true if file information was retrieved successfully, false otherwise. + + + Portable implementation of . + + + + + Returns details about current process and thread in a portable manner. + + + + + Initializes static members of the ThreadIDHelper class. + + + + + Gets the singleton instance of PortableThreadIDHelper or + Win32ThreadIDHelper depending on runtime environment. + + The instance. + + + + Gets current thread ID. + + + + + Gets current process ID. + + + + + Gets current process name. + + + + + Gets current process name (excluding filename extension, if any). + + + + + Initializes a new instance of the class. + + + + + Gets the name of the process. + + + + + Gets current thread ID. + + + + + + Gets current process ID. + + + + + + Gets current process name. + + + + + + Gets current process name (excluding filename extension, if any). + + + Reflection helpers for accessing properties. @@ -3299,43 +3894,6 @@ The next item in the chain. - - - Returns details about current process and thread in a portable manner. - - - - - Initializes static members of the ThreadIDHelper class. - - - - - Gets the singleton instance of PortableThreadIDHelper or - Win32ThreadIDHelper depending on runtime environment. - - The instance. - - - - Gets current thread ID. - - - - - Gets current process ID. - - - - - Gets current process name. - - - - - Gets current process name (excluding filename extension, if any). - - Wraps with a timeout. @@ -3364,6 +3922,23 @@ URL Encoding helper. + + + Win32-optimized implementation of . + + + + + Gets the information about a file. + + Name of the file. + The file handle. + The last write time of the file. + Length of the file. + + A value of true if file information was retrieved successfully, false otherwise. + + Win32-optimized implementation of . @@ -3409,9 +3984,9 @@ Ambient property name. - + - The current application domain's base directory. + ASP Application variable. @@ -3489,6 +4064,84 @@ Gets the logging configuration this target is part of. + + + Renders the specified ASP Application variable and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Gets or sets the ASP Application variable name. + + + + + + ASP Request variable. + + + + + Renders the specified ASP Request variable and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Gets or sets the item name. The QueryString, Form, Cookies, or ServerVariables collection variables having the specified name are rendered. + + + + + + Gets or sets the QueryString variable to be rendered. + + + + + + Gets or sets the form variable to be rendered. + + + + + + Gets or sets the cookie to be rendered. + + + + + + Gets or sets the ServerVariables item to be rendered. + + + + + + ASP Session variable. + + + + + Renders the specified ASP Session variable and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Gets or sets the session variable name. + + + + + + The current application domain's base directory. + + Initializes a new instance of the class. @@ -3513,6 +4166,52 @@ + + + The call site (class name, method name and source information). + + + + + Initializes a new instance of the class. + + + + + Renders the call site and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Gets or sets a value indicating whether to render the class name. + + + + + + Gets or sets a value indicating whether to render the method name. + + + + + + Gets or sets a value indicating whether to render the source file name and line number. + + + + + + Gets or sets a value indicating whether to include source file path. + + + + + + Gets the level of stack trace information required by the implementing class. + + A counter value (increases on each layout rendering). @@ -3577,6 +4276,24 @@ + + + The environment variable. + + + + + Renders the specified environment variable and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Gets or sets the name of the environment variable. + + + Log event context data. @@ -3657,6 +4374,29 @@ The encoding. + + + The information about the garbage collector. + + + + + Initializes a new instance of the class. + + + + + Renders the selected process information. + + The to append the rendered data to. + Logging event. + + + + Gets or sets the property to retrieve. + + + Gets or sets the property of System.GC to retrieve. @@ -3733,6 +4473,55 @@ + + + Thread identity information (name and authentication information). + + + + + Initializes a new instance of the class. + + + + + Renders the specified identity information and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Gets or sets the separator to be used when concatenating + parts of identity information. + + + + + + Gets or sets a value indicating whether to render Thread.CurrentPrincipal.Identity.Name. + + + + + + Gets or sets a value indicating whether to render Thread.CurrentPrincipal.Identity.AuthenticationType. + + + + + + Gets or sets a value indicating whether to render Thread.CurrentPrincipal.Identity.IsAuthenticated. + + + + + + Gets or sets a value indicating whether to modify the output of this renderer so it can be used as a part of file path + (illegal characters are replaced with '_'). + + + Installation parameter (passed to InstallNLogConfig). @@ -3843,6 +4632,18 @@ + + + Gets or sets a value indicating whether to include call site (class and method name) in the information sent over the network. + + + + + + Gets or sets a value indicating whether to include source info (file name and line number) in the information sent over the network. + + + Gets or sets a value indicating whether to include contents of the dictionary. @@ -3890,6 +4691,23 @@ The to append the rendered data to. Logging event. + + + The machine name that the process is running on. + + + + + Initializes the layout renderer. + + + + + Renders the machine name and appends it to the specified . + + The to append the rendered data to. + Logging event. + Mapped Diagnostic Context item. Provided for compatibility with log4net. @@ -3996,6 +4814,52 @@ + + + The performance counter. + + + + + Initializes the layout renderer. + + + + + Closes the layout renderer. + + + + + Renders the specified environment variable and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Gets or sets the name of the counter category. + + + + + + Gets or sets the name of the performance counter. + + + + + + Gets or sets the name of the performance counter instance (e.g. this.Global_). + + + + + + Gets or sets the name of the machine to read the performance counter from. + + + The identifier of the current process. @@ -4008,6 +4872,239 @@ The to append the rendered data to. Logging event. + + + The information about the running process. + + + + + Initializes a new instance of the class. + + + + + Initializes the layout renderer. + + + + + Closes the layout renderer. + + + + + Renders the selected process information. + + The to append the rendered data to. + Logging event. + + + + Gets or sets the property to retrieve. + + + + + + Property of System.Diagnostics.Process to retrieve. + + + + + Base Priority. + + + + + Exit Code. + + + + + Exit Time. + + + + + Process Handle. + + + + + Handle Count. + + + + + Whether process has exited. + + + + + Process ID. + + + + + Machine name. + + + + + Handle of the main window. + + + + + Title of the main window. + + + + + Maximum Working Set. + + + + + Minimum Working Set. + + + + + Non-paged System Memory Size. + + + + + Non-paged System Memory Size (64-bit). + + + + + Paged Memory Size. + + + + + Paged Memory Size (64-bit).. + + + + + Paged System Memory Size. + + + + + Paged System Memory Size (64-bit). + + + + + Peak Paged Memory Size. + + + + + Peak Paged Memory Size (64-bit). + + + + + Peak Vitual Memory Size. + + + + + Peak Virtual Memory Size (64-bit).. + + + + + Peak Working Set Size. + + + + + Peak Working Set Size (64-bit). + + + + + Whether priority boost is enabled. + + + + + Priority Class. + + + + + Private Memory Size. + + + + + Private Memory Size (64-bit). + + + + + Privileged Processor Time. + + + + + Process Name. + + + + + Whether process is responding. + + + + + Session ID. + + + + + Process Start Time. + + + + + Total Processor Time. + + + + + User Processor Time. + + + + + Virtual Memory Size. + + + + + Virtual Memory Size (64-bit). + + + + + Working Set Size. + + + + + Working Set Size (64-bit). + + The name of the current process. @@ -4170,6 +5267,110 @@ Whether application is running with elevated permissions. + + + System special folder path (includes My Documents, My Music, Program Files, Desktop, and more). + + + + + Renders the directory where NLog is located and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Gets or sets the system special folder to use. + + + Full list of options is available at MSDN. + The most common ones are: +
    +
  • ApplicationData - roaming application data for current user.
  • +
  • CommonApplicationData - application data for all users.
  • +
  • MyDocuments - My Documents
  • +
  • DesktopDirectory - Desktop directory
  • +
  • LocalApplicationData - non roaming application data
  • +
  • Personal - user profile directory
  • +
  • System - System directory
  • +
+
+ +
+ + + Gets or sets the name of the file to be Path.Combine()'d with the directory name. + + + + + + Gets or sets the name of the directory to be Path.Combine()'d with the directory name. + + + + + + Format of the ${stacktrace} layout renderer output. + + + + + Raw format (multiline - as returned by StackFrame.ToString() method). + + + + + Flat format (class and method names displayed in a single line). + + + + + Detailed flat format (method signatures displayed in a single line). + + + + + Stack trace renderer. + + + + + Initializes a new instance of the class. + + + + + Renders the call site and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Gets or sets the output format of the stack trace. + + + + + + Gets or sets the number of top stack frames to be rendered. + + + + + + Gets or sets the stack frame separator string. + + + + + + Gets the level of stack trace information required by the implementing class. + + + A temporary directory. @@ -4230,6 +5431,35 @@ The to append the rendered data to. Logging event. + + + Thread Windows identity information (username). + + + + + Initializes a new instance of the class. + + + + + Renders the current thread windows identity information and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Gets or sets a value indicating whether domain name should be included. + + + + + + Gets or sets a value indicating whether username should be included. + + + Applies caching to another layout output. @@ -4477,7 +5707,7 @@ The text to be post-processed. Trimmed string. - + Gets or sets a value indicating whether lower case conversion should be applied. @@ -5085,6 +6315,13 @@ String representation of the log event. + + + Sets the stack trace for the event info. + + The stack trace. + Index of the first user stack frame within the stack trace. + Gets the unique identifier of log event which is automatically generated @@ -5101,6 +6338,27 @@ Gets or sets the level of the logging event. + + + Gets a value indicating whether stack trace has been set for this event. + + + + + Gets the stack frame of the method that did the logging. + + + + + Gets the number index of the stack frame that represents the user + code (not the NLog code). + + + + + Gets the entire stack trace. + + Gets or sets the exception information. @@ -5174,6 +6432,23 @@ Null logger instance. + + + Gets the logger named after the currently-being-initialized class. + + The logger. + This is a slow-running method. + Make sure you're not doing this in a loop. + + + + Gets the logger named after the currently-being-initialized class. + + The type of the logger to create. The type must inherit from NLog.Logger. + The logger. + This is a slow-running method. + Make sure you're not doing this in a loop. + Gets the specified named logger. @@ -5267,6 +6542,11 @@ Occurs when logging changes. + + + Occurs when logging gets reloaded. + + Gets or sets a value indicating whether exceptions should be thrown. @@ -5335,6 +6615,14 @@ The logger name. An instance of . + + + Gets the logger named after the currently-being-initialized class. + + The logger. + This is a slow-running method. + Make sure you're not doing this in a loop. + Provides logging interface and utility functions. @@ -8024,11 +9312,33 @@ Creates and manages instances of objects. + + + Initializes static members of the LogManager class. + + Prevents a default instance of the LogManager class from being created. + + + Gets the logger named after the currently-being-initialized class. + + The logger. + This is a slow-running method. + Make sure you're not doing this in a loop. + + + + Gets the logger named after the currently-being-initialized class. + + The logger class. The class must inherit from . + The logger. + This is a slow-running method. + Make sure you're not doing this in a loop. + Creates a logger that discards all log messages. @@ -8121,6 +9431,11 @@ Occurs when logging changes. + + + Occurs when logging gets reloaded. + + Gets or sets a value indicating whether NLog should throw exceptions. @@ -8166,6 +9481,22 @@ The result. + + + Log Receiver Client Channel. + + + + + Service contract for Log Receiver server. + + + + + Processes the log messages. + + The events. + Internal configuration of Log Receiver Service contracts. @@ -8277,40 +9608,6 @@ The events. - - - Log Receiver Client using legacy SOAP client. - - - - - Initializes a new instance of the class. - - The service URL. - - - - Processes the log messages. - - The events. - - - - Begins processing of log messages. - - The events. - The callback. - Asynchronous state. - - IAsyncResult value which can be passed to . - - - - - Ends asynchronous processing of log messages. - - The result. - List of strings annotated for more terse serialization. @@ -8321,6 +9618,110 @@ Initializes a new instance of the class. + + + Log Receiver Client using WCF. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Name of the endpoint configuration. + + + + Initializes a new instance of the class. + + Name of the endpoint configuration. + The remote address. + + + + Initializes a new instance of the class. + + Name of the endpoint configuration. + The remote address. + + + + Initializes a new instance of the class. + + The binding. + The remote address. + + + + Opens the client asynchronously. + + + + + Opens the client asynchronously. + + User-specific state. + + + + Closes the client asynchronously. + + + + + Closes the client asynchronously. + + User-specific state. + + + + Processes the log messages asynchronously. + + The events to send. + + + + Processes the log messages asynchronously. + + The events to send. + User-specific state. + + + + Begins processing of log messages. + + The events to send. + The callback. + Asynchronous state. + + IAsyncResult value which can be passed to . + + + + + Ends asynchronous processing of log messages. + + The result. + + + + Occurs when the log message processing has completed. + + + + + Occurs when Open operation has completed. + + + + + Occurs when Close operation has completed. + + Mapped Diagnostics Context - a thread-local structure that keeps a dictionary @@ -8509,6 +9910,19 @@ The message. The inner exception. + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + The parameter is null. + + + The class name is null or is zero (0). + + Exception thrown during log event processing. @@ -8532,6 +9946,19 @@ The message. The inner exception. + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + The parameter is null. + + + The class name is null or is zero (0). + + TraceListener which routes all messages through NLog. @@ -8577,6 +10004,81 @@ Flushes the output buffer. + + + Writes trace information, a data object and event information to the listener specific output. + + A object that contains the current process ID, thread ID, and stack trace information. + A name used to identify the output, typically the name of the application that generated the trace event. + One of the values specifying the type of event that has caused the trace. + A numeric identifier for the event. + The trace data to emit. + + + + Writes trace information, an array of data objects and event information to the listener specific output. + + A object that contains the current process ID, thread ID, and stack trace information. + A name used to identify the output, typically the name of the application that generated the trace event. + One of the values specifying the type of event that has caused the trace. + A numeric identifier for the event. + An array of objects to emit as data. + + + + Writes trace and event information to the listener specific output. + + A object that contains the current process ID, thread ID, and stack trace information. + A name used to identify the output, typically the name of the application that generated the trace event. + One of the values specifying the type of event that has caused the trace. + A numeric identifier for the event. + + + + Writes trace information, a formatted array of objects and event information to the listener specific output. + + A object that contains the current process ID, thread ID, and stack trace information. + A name used to identify the output, typically the name of the application that generated the trace event. + One of the values specifying the type of event that has caused the trace. + A numeric identifier for the event. + A format string that contains zero or more format items, which correspond to objects in the array. + An object array containing zero or more objects to format. + + + + Writes trace information, a message, and event information to the listener specific output. + + A object that contains the current process ID, thread ID, and stack trace information. + A name used to identify the output, typically the name of the application that generated the trace event. + One of the values specifying the type of event that has caused the trace. + A numeric identifier for the event. + A message to write. + + + + Writes trace information, a message, a related activity identity and event information to the listener specific output. + + A object that contains the current process ID, thread ID, and stack trace information. + A name used to identify the output, typically the name of the application that generated the trace event. + A numeric identifier for the event. + A message to write. + A object identifying a related activity. + + + + Gets the custom attributes supported by the trace listener. + + + A string array naming the custom attributes supported by the trace listener, or null if there are no custom attributes. + + + + + Translates the event type to level from . + + Type of the event. + Translated log level. + Gets or sets the log factory to use when outputting messages (null - use LogManager). @@ -8592,6 +10094,18 @@ Gets or sets the log which should be always used regardless of source level. + + + Gets a value indicating whether the trace listener is thread safe. + + + true if the trace listener is thread safe; otherwise, false. The default is false. + + + + Gets or sets a value indicating whether to use auto logger name detected from the stack trace. + + Specifies the way archive numbering is performed. @@ -8607,98 +10121,11 @@ Rolling style numbering (the most recent is always #0 then #1, ..., #N. - + - Sends log messages to the remote instance of Chainsaw application from log4j. + Outputs log messages through the ASP Response object. - Documentation on NLog Wiki - -

- To set up the target in the configuration file, - use the following syntax: -

- -

- This assumes just one target and a single rule. More configuration - options are described here. -

-

- To set up the log target programmatically use code like this: -

- -

- NOTE: If your receiver application is ever likely to be off-line, don't use TCP protocol - or you'll get TCP timeouts and your application will crawl. - Either switch to UDP transport or use AsyncWrapper target - so that your application threads will not be blocked by the timing-out connection attempts. -

-
-
- - - Sends log messages to the remote instance of NLog Viewer. - - Documentation on NLog Wiki - -

- To set up the target in the configuration file, - use the following syntax: -

- -

- This assumes just one target and a single rule. More configuration - options are described here. -

-

- To set up the log target programmatically use code like this: -

- -

- NOTE: If your receiver application is ever likely to be off-line, don't use TCP protocol - or you'll get TCP timeouts and your application will crawl. - Either switch to UDP transport or use AsyncWrapper target - so that your application threads will not be blocked by the timing-out connection attempts. -

-
-
- - - Sends log messages over the network. - - Documentation on NLog Wiki - -

- To set up the target in the configuration file, - use the following syntax: -

- -

- This assumes just one target and a single rule. More configuration - options are described here. -

-

- To set up the log target programmatically use code like this: -

- -

- To print the results, use any application that's able to receive messages over - TCP or UDP. NetCat is - a simple but very powerful command-line tool that can be used for that. This image - demonstrates the NetCat tool receiving log messages from Network target. -

- -

- NOTE: If your receiver application is ever likely to be off-line, don't use TCP protocol - or you'll get TCP timeouts and your application will crawl. - Either switch to UDP transport or use AsyncWrapper target - so that your application threads will not be blocked by the timing-out connection attempts. -

-

- There are two specialized versions of the Network target: Chainsaw - and NLogViewer which write to instances of Chainsaw log4j viewer - or NLogViewer application respectively. -

-
+ Documentation on NLog Wiki
@@ -8854,6 +10281,111 @@ + + + Outputs the rendered logging event through the OutputDebugString() Win32 API. + + The logging event. + + + + Gets or sets a value indicating whether to add <!-- --> comments around all written texts. + + + + + + Sends log messages to the remote instance of Chainsaw application from log4j. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +

+ NOTE: If your receiver application is ever likely to be off-line, don't use TCP protocol + or you'll get TCP timeouts and your application will crawl. + Either switch to UDP transport or use AsyncWrapper target + so that your application threads will not be blocked by the timing-out connection attempts. +

+
+
+ + + Sends log messages to the remote instance of NLog Viewer. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +

+ NOTE: If your receiver application is ever likely to be off-line, don't use TCP protocol + or you'll get TCP timeouts and your application will crawl. + Either switch to UDP transport or use AsyncWrapper target + so that your application threads will not be blocked by the timing-out connection attempts. +

+
+
+ + + Sends log messages over the network. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +

+ To print the results, use any application that's able to receive messages over + TCP or UDP. NetCat is + a simple but very powerful command-line tool that can be used for that. This image + demonstrates the NetCat tool receiving log messages from Network target. +

+ +

+ NOTE: If your receiver application is ever likely to be off-line, don't use TCP protocol + or you'll get TCP timeouts and your application will crawl. + Either switch to UDP transport or use AsyncWrapper target + so that your application threads will not be blocked by the timing-out connection attempts. +

+

+ There are two specialized versions of the Network target: Chainsaw + and NLogViewer which write to instances of Chainsaw log4j viewer + or NLogViewer application respectively. +

+
+
Initializes a new instance of the class. @@ -8962,6 +10494,18 @@ + + + Gets or sets a value indicating whether to include call site (class and method name) in the information sent over the network. + + + + + + Gets or sets a value indicating whether to include source info (file name and line number) in the information sent over the network. + + + Gets or sets a value indicating whether to include dictionary contents. @@ -8996,26 +10540,11 @@ Initializes a new instance of the class. - + - Writes log messages to the console. + Writes log messages to the console with customizable coloring. - Documentation on NLog Wiki - -

- To set up the target in the configuration file, - use the following syntax: -

- -

- This assumes just one target and a single rule. More configuration - options are described here. -

-

- To set up the log target programmatically use code like this: -

- -
+ Documentation on NLog Wiki
@@ -9054,6 +10583,273 @@ The layout with header and footer. + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Initializes the target. + + + + + Closes the target and releases any unmanaged resources. + + + + + Writes the specified log event to the console highlighting entries + and words based on a set of defined rules. + + Log event. + + + + Gets or sets a value indicating whether the error stream (stderr) should be used instead of the output stream (stdout). + + + + + + Gets or sets a value indicating whether to use default row highlighting rules. + + + The default rules are: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ConditionForeground ColorBackground Color
level == LogLevel.FatalRedNoChange
level == LogLevel.ErrorYellowNoChange
level == LogLevel.WarnMagentaNoChange
level == LogLevel.InfoWhiteNoChange
level == LogLevel.DebugGrayNoChange
level == LogLevel.TraceDarkGrayNoChange
+
+ +
+ + + Gets the row highlighting rules. + + + + + + Gets the word highlighting rules. + + + + + + Color pair (foreground and background). + + + + + Colored console output color. + + + Note that this enumeration is defined to be binary compatible with + .NET 2.0 System.ConsoleColor + some additions + + + + + Black Color (#000000). + + + + + Dark blue Color (#000080). + + + + + Dark green Color (#008000). + + + + + Dark Cyan Color (#008080). + + + + + Dark Red Color (#800000). + + + + + Dark Magenta Color (#800080). + + + + + Dark Yellow Color (#808000). + + + + + Gray Color (#C0C0C0). + + + + + Dark Gray Color (#808080). + + + + + Blue Color (#0000FF). + + + + + Green Color (#00FF00). + + + + + Cyan Color (#00FFFF). + + + + + Red Color (#FF0000). + + + + + Magenta Color (#FF00FF). + + + + + Yellow Color (#FFFF00). + + + + + White Color (#FFFFFF). + + + + + Don't change the color. + + + + + The row-highlighting condition. + + + + + Initializes static members of the ConsoleRowHighlightingRule class. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The condition. + Color of the foreground. + Color of the background. + + + + Checks whether the specified log event matches the condition (if any). + + + Log event. + + + A value of if the condition is not defined or + if it matches, otherwise. + + + + + Gets the default highlighting rule. Doesn't change the color. + + + + + Gets or sets the condition that must be met in order to set the specified foreground and background color. + + + + + + Gets or sets the foreground color. + + + + + + Gets or sets the background color. + + + + + + Writes log messages to the console. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +
+
Initializes the target. @@ -9074,6 +10870,71 @@ Note that the Error option is not supported on .NET Compact Framework. + + + Gets or sets a value indicating whether to send the log messages to the standard error instead of the standard output. + + + + + + Highlighting rule for Win32 colorful console. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The text to be matched.. + Color of the foreground. + Color of the background. + + + + Gets or sets the regular expression to be matched. You must specify either text or regex. + + + + + + Gets or sets the text to be matched. You must specify either text or regex. + + + + + + Gets or sets a value indicating whether to match whole words only. + + + + + + Gets or sets a value indicating whether to ignore case when comparing texts. + + + + + + Gets the compiled regular expression that matches either Text or Regex property. + + + + + Gets or sets the foreground color. + + + + + + Gets or sets the background color. + + + Information about database command + parameters. @@ -9267,6 +11128,12 @@ + + + Gets or sets the name of the connection string (as specified in <connectionStrings> configuration section. + + + Gets or sets the connection string. When provided, it overrides the values @@ -9359,6 +11226,42 @@ + + + Writes log messages to the attached managed debugger. + + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +
+
+ + + Initializes the target. + + + + + Closes the target and releases any unmanaged resources. + + + + + Writes the specified logging event to the attached debugger. + + The logging event. + Mock target - useful for testing. @@ -9406,6 +11309,98 @@ + + + Writes log message to the Event Log. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +
+
+ + + Initializes a new instance of the class. + + + + + Performs installation which requires administrative permissions. + + The installation context. + + + + Performs uninstallation which requires administrative permissions. + + The installation context. + + + + Determines whether the item is installed. + + The installation context. + + Value indicating whether the item is installed or null if it is not possible to determine. + + + + + Initializes the target. + + + + + Writes the specified logging event to the event log. + + The logging event. + + + + Gets or sets the name of the machine on which Event Log service is running. + + + + + + Gets or sets the layout that renders event ID. + + + + + + Gets or sets the layout that renders event Category. + + + + + + Gets or sets the value to be used as the event Source. + + + By default this is the friendly name of the current AppDomain. + + + + + + Gets or sets the name of the Event Log to write to. This can be System, Application or + any user-defined name. + + + Modes of archiving files based on time. @@ -9592,6 +11587,12 @@ + + + Gets or sets the file attributes (Windows only). + + + Gets or sets the line ending mode. @@ -9742,6 +11743,59 @@ Gets the characters that are appended after each line. + + + Logs text to Windows.Forms.Control.Text property control of specified Name. + + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ The result is: +

+ +

+ To set up the log target programmatically similar to above use code like this: +

+ , +
+
+ + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Log message to control. + + + The logging event. + + + + + Gets or sets the name of control to which NLog will log write log text. + + + + + + Gets or sets a value indicating whether log text should be appended to the text of the control instead of overwriting it. + + + + + Gets or sets the name of the Form on which the control is located. + + + Line ending mode. @@ -9805,6 +11859,19 @@ The endpoint address. + + + Gets or sets the name of the endpoint configuration in WCF configuration file. + + The name of the endpoint configuration. + + + + + Gets or sets a value indicating whether to use binary message encoding. + + + Gets or sets the client ID. @@ -9819,6 +11886,152 @@ The parameters. + + + Sends log messages by email using SMTP protocol. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +

+ Mail target works best when used with BufferingWrapper target + which lets you send multiple log messages in single mail +

+

+ To set up the buffered mail target in the configuration file, + use the following syntax: +

+ +

+ To set up the buffered mail target programmatically use code like this: +

+ +
+
+ + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Renders the logging event message and adds it to the internal ArrayList of log messages. + + The logging event. + + + + Renders an array logging events. + + Array of logging events. + + + + Gets or sets sender's email address (e.g. joe@domain.com). + + + + + + Gets or sets recipients' email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + + Gets or sets CC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + + Gets or sets BCC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + + Gets or sets a value indicating whether to add new lines between log entries. + + A value of true if new lines should be added; otherwise, false. + + + + + Gets or sets the mail subject. + + + + + + Gets or sets mail message body (repeated for each log message send in one mail). + + Alias for the Layout property. + + + + + Gets or sets encoding to be used for sending e-mail. + + + + + + Gets or sets a value indicating whether to send message as HTML instead of plain text. + + + + + + Gets or sets SMTP Server to be used for sending. + + + + + + Gets or sets SMTP Authentication mode. + + + + + + Gets or sets the username used to connect to SMTP server (used when SmtpAuthentication is set to "basic"). + + + + + + Gets or sets the password used to authenticate against SMTP server (used when SmtpAuthentication is set to "basic"). + + + + + + Gets or sets a value indicating whether SSL (secure sockets layer) should be used when communicating with SMTP server. + + + + + + Gets or sets the port number that SMTP Server is listening on. + + + Writes log messages to an ArrayList in memory for programmatic retrieval. @@ -10112,6 +12325,486 @@ + + + Outputs log messages through the OutputDebugString() Win32 API. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +
+
+ + + Outputs the rendered logging event through the OutputDebugString() Win32 API. + + The logging event. + + + + Increments specified performance counter on each write. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +
+ + TODO: + 1. Unable to create a category allowing multiple counter instances (.Net 2.0 API only, probably) + 2. Is there any way of adding new counters without deleting the whole category? + 3. There should be some mechanism of resetting the counter (e.g every day starts from 0), or auto-switching to + another counter instance (with dynamic creation of new instance). This could be done with layouts. + +
+ + + Initializes a new instance of the class. + + + + + Performs installation which requires administrative permissions. + + The installation context. + + + + Performs uninstallation which requires administrative permissions. + + The installation context. + + + + Determines whether the item is installed. + + The installation context. + + Value indicating whether the item is installed or null if it is not possible to determine. + + + + + Increments the configured performance counter. + + Log event. + + + + Closes the target and releases any unmanaged resources. + + + + + Ensures that the performance counter has been initialized. + + True if the performance counter is operational, false otherwise. + + + + Gets or sets a value indicating whether performance counter should be automatically created. + + + + + + Gets or sets the name of the performance counter category. + + + + + + Gets or sets the name of the performance counter. + + + + + + Gets or sets the performance counter instance name. + + + + + + Gets or sets the counter help text. + + + + + + Gets or sets the performance counter type. + + + + + + The row-coloring condition. + + + + + Initializes static members of the RichTextBoxRowColoringRule class. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The condition. + Color of the foregroung text. + Color of the background text. + The font style. + + + + Initializes a new instance of the class. + + The condition. + Color of the text. + Color of the background. + + + + Checks whether the specified log event matches the condition (if any). + + + Log event. + + + A value of if the condition is not defined or + if it matches, otherwise. + + + + + Gets the default highlighting rule. Doesn't change the color. + + + + + + Gets or sets the condition that must be met in order to set the specified font color. + + + + + + Gets or sets the font color. + + + Names are identical with KnownColor enum extended with Empty value which means that background color won't be changed. + + + + + + Gets or sets the background color. + + + Names are identical with KnownColor enum extended with Empty value which means that background color won't be changed. + + + + + + Gets or sets the font style of matched text. + + + Possible values are the same as in FontStyle enum in System.Drawing + + + + + + Log text a Rich Text Box control in an existing or new form. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ The result is: +

+ To set up the target with coloring rules in the configuration file, + use the following syntax: +

+ + + +

+ The result is: +

+ To set up the log target programmatically similar to above use code like this: +

+ + , + + + for RowColoring, + + + for WordColoring +
+
+ + + Initializes static members of the RichTextBoxTarget class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Initializes the target. Can be used by inheriting classes + to initialize logging. + + + + + Closes the target and releases any unmanaged resources. + + + + + Log message to RichTextBox. + + The logging event. + + + + Gets the default set of row coloring rules which applies when is set to true. + + + + + Gets or sets the Name of RichTextBox to which Nlog will write. + + + + + + Gets or sets the 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. + + + + + + Gets or sets a value indicating whether to use default coloring rules. + + + + + + Gets the row coloring rules. + + + + + + Gets the word highlighting rules. + + + + + + Gets or sets a value indicating whether the created window will be a tool window. + + + This parameter is ignored when logging to existing form control. + Tool windows have thin border, and do not show up in the task bar. + + + + + + Gets or sets a value indicating whether the created form will be initially minimized. + + + This parameter is ignored when logging to existing form control. + + + + + + Gets or sets the initial width of the form with rich text box. + + + This parameter is ignored when logging to existing form control. + + + + + + Gets or sets the initial height of the form with rich text box. + + + This parameter is ignored when logging to existing form control. + + + + + + Gets or sets a value indicating whether scroll bar will be moved automatically to show most recent log entries. + + + + + + Gets or sets the maximum number of lines the rich text box will store (or 0 to disable this feature). + + + After exceeding the maximum number, first line will be deleted. + + + + + + Gets or sets the form to log to. + + + + + Gets or sets the rich text box to log to. + + + + + Highlighting rule for Win32 colorful console. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The text to be matched.. + Color of the text. + Color of the background. + + + + Initializes a new instance of the class. + + The text to be matched.. + Color of the text. + Color of the background. + The font style. + + + + Gets or sets the regular expression to be matched. You must specify either text or regex. + + + + + + Gets or sets the text to be matched. You must specify either text or regex. + + + + + + Gets or sets a value indicating whether to match whole words only. + + + + + + Gets or sets a value indicating whether to ignore case when comparing texts. + + + + + + Gets or sets the font style of matched text. + Possible values are the same as in FontStyle enum in System.Drawing. + + + + + + Gets the compiled regular expression that matches either Text or Regex property. + + + + + Gets or sets the font color. + Names are identical with KnownColor enum extended with Empty value which means that font color won't be changed. + + + + + + Gets or sets the background color. + Names are identical with KnownColor enum extended with Empty value which means that background color won't be changed. + + + + + + SMTP authentication modes. + + + + + No authentication. + + + + + Basic - username and password. + + + + + NTLM Authentication. + + Marks class as a logging target and assigns a name to it. @@ -10133,6 +12826,36 @@ Gets or sets a value indicating whether to the target is a compound target (used to generate the target summary documentation page). + + + Sends log messages through System.Diagnostics.Trace. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +
+
+ + + Writes the specified logging event to the facility. + If the log level is greater than or equal to it uses the + method, otherwise it uses + method. + + The logging event. + Web service protocol. @@ -10219,6 +12942,95 @@ + + + Win32 file attributes. + + + For more information see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/createfile.asp. + + + + + Read-only file. + + + + + Hidden file. + + + + + System file. + + + + + File should be archived. + + + + + Device file. + + + + + Normal file. + + + + + File is temporary (should be kept in cache and not + written to disk if possible). + + + + + Sparse file. + + + + + Reparse point. + + + + + Compress file contents. + + + + + File should not be indexed by the content indexing service. + + + + + Encrypted file. + + + + + The system writes through any intermediate cache and goes directly to disk. + + + + + The system opens a file with no system caching. + + + + + Delete file after it is closed. + + + + + A file is accessed according to POSIX rules. + + Asynchronous request queue. @@ -10437,6 +13249,11 @@ Discard the overflowing item. + + + Block until there's more room in the queue. + + Causes a flush after each write on a wrapped target. @@ -10715,6 +13532,112 @@ + + + Impersonates another user for the duration of the write. + + Documentation on NLog Wiki + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The wrapped target. + + + + Initializes the impersonation context. + + + + + Closes the impersonation context. + + + + + Changes the security context, forwards the call to the .Write() + and switches the context back to original. + + The log event. + + + + Changes the security context, forwards the call to the .Write() + and switches the context back to original. + + Log events. + + + + Flush any pending log messages (in case of asynchronous targets). + + The asynchronous continuation. + + + + Gets or sets username to change context to. + + + + + + Gets or sets the user account password. + + + + + + Gets or sets Windows domain name to change context to. + + + + + + Gets or sets the Logon Type. + + + + + + Gets or sets the type of the logon provider. + + + + + + Gets or sets the required impersonation level. + + + + + + Gets or sets a value indicating whether to revert to the credentials of the process instead of impersonating another user. + + + + + + Helper class which reverts the given + to its original value as part of . + + + + + Initializes a new instance of the class. + + The windows impersonation context. + + + + Reverts the impersonation context. + + Logon provider. diff --git a/NzbDrone.Core/Main.cs b/NzbDrone.Core/Main.cs index 8e22872a1..7a1a10b3d 100644 --- a/NzbDrone.Core/Main.cs +++ b/NzbDrone.Core/Main.cs @@ -1,11 +1,13 @@ using System; using System.IO; using System.Web; -using log4net; using Ninject; +using NLog.Config; +using NLog.Targets; using NzbDrone.Core.Providers; using SubSonic.DataProviders; using SubSonic.Repository; +using NLog; namespace NzbDrone.Core { @@ -20,7 +22,7 @@ namespace NzbDrone.Core kernel.Bind().To(); kernel.Bind().To(); kernel.Bind().To(); - kernel.Bind().ToMethod(c => LogManager.GetLogger("logger-name")); + kernel.Bind().ToMethod(c => log4net.LogManager.GetLogger("logger-name")); kernel.Bind().ToMethod(c => new SimpleRepository(provider, SimpleRepositoryOptions.RunMigrations)); } @@ -28,5 +30,42 @@ namespace NzbDrone.Core { get { return new DirectoryInfo(HttpContext.Current.Server.MapPath("\\")).Parent.FullName; } } + + + public static void ConfigureNlog() + { + // Step 1. Create configuration object + var config = new LoggingConfiguration(); + + // Step 2. Create targets and add them to the configuration + var consoleTarget = new DebuggerTarget(); + config.AddTarget("console", consoleTarget); + + FileTarget fileTarget = new FileTarget(); + config.AddTarget("file", fileTarget); + + // Step 3. Set target properties + consoleTarget.Layout = "${logger} ${message}"; + fileTarget.FileName = "${basedir}/test.log"; + fileTarget.Layout = "${message}"; + + // Step 4. Define rules + LoggingRule rule1 = new LoggingRule("*", LogLevel.Trace, consoleTarget); + config.LoggingRules.Add(rule1); + + LoggingRule rule2 = new LoggingRule("*", LogLevel.Trace, fileTarget); + config.LoggingRules.Add(rule2); + + // Step 5. Activate the configuration + NLog.LogManager.Configuration = config; + + Logger logger = LogManager.GetCurrentClassLogger(); + logger.Trace("trace log message"); + logger.Debug("debug log message"); + logger.Info("info log message"); + logger.Warn("warn log message"); + logger.Error("error log message"); + logger.Fatal("fatal log message"); + } } } \ No newline at end of file diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 87cb933e7..8b7ce5d92 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -128,6 +128,10 @@ + + False + Libraries\NLog.Extended.dll + False Libraries\SubSonic.Core.dll @@ -202,6 +206,9 @@ + + + @@ -212,9 +219,6 @@ - - -