├── src ├── App.config ├── Logger │ ├── ILoggerFactory.cs │ ├── NLoggerFactory.cs │ ├── ILogger.cs │ └── NLogger.cs ├── Context │ └── CallContext.cs ├── packages.config ├── MiddlewareBase.cs ├── Utility │ ├── MapOptions.cs │ ├── PathStringHelper.cs │ ├── MapMiddleware.cs │ └── PathString.cs ├── Properties │ └── AssemblyInfo.cs ├── CallBuilder.cs ├── NLog.config ├── MapExtensions.cs ├── UseExtensions.cs ├── Program.cs ├── AsyncMiddleWare.csproj └── NLog.xsd ├── README.md ├── AsyncMiddleWare.sln ├── LICENSE └── .gitignore /src/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AsyncMiddleWare 2 | 模仿.net core mvc中间件的设计模式(简化版),实现参考了asp.net core的代码[HttpAbstractions](https://github.com/aspnet/HttpAbstractions "HttpAbstractions")和nodejs的开源库[koa](https://github.com/koajs/koa "koa") 3 | -------------------------------------------------------------------------------- /src/Logger/ILoggerFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AsyncMiddleWare.Logger 4 | { 5 | public interface ILoggerFactory 6 | { 7 | ILogger CreateLogger(Type type); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Context/CallContext.cs: -------------------------------------------------------------------------------- 1 | using AsyncMiddleWare.Utility; 2 | 3 | namespace AsyncMiddleWare.Context 4 | { 5 | public sealed class CallContext 6 | { 7 | public PathString Path { get; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Logger/NLoggerFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AsyncMiddleWare.Logger 4 | { 5 | public sealed class NLoggerFactory : ILoggerFactory 6 | { 7 | public ILogger CreateLogger(Type type) 8 | { 9 | return new NLogger() { AttachParent = type }; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MiddlewareBase.cs: -------------------------------------------------------------------------------- 1 | using AsyncMiddleWare.Context; 2 | using AsyncMiddleWare.Logger; 3 | using System.Threading.Tasks; 4 | 5 | namespace AsyncMiddleWare 6 | { 7 | public abstract class MiddlewareBase 8 | { 9 | protected readonly CallDelegate _next; 10 | protected readonly ILogger _logger; 11 | public MiddlewareBase(CallDelegate next, ILoggerFactory loggerFactory) 12 | { 13 | _next = next; 14 | _logger = loggerFactory.CreateLogger(this.GetType()); 15 | } 16 | 17 | public abstract Task Invoke(CallContext context); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Logger/ILogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AsyncMiddleWare.Logger 4 | { 5 | public interface ILogger 6 | { 7 | Type AttachParent { get; } 8 | void Debug(string msg, params object[] args); 9 | void Debug(string msg, Exception err, params object[] args); 10 | void Info(string msg, params object[] args); 11 | void Info(string msg, Exception err, params object[] args); 12 | void Trace(string msg, params object[] args); 13 | void Trace(string msg, Exception err, params object[] args); 14 | void Error(string msg, params object[] args); 15 | void Error(string msg, Exception err, params object[] args); 16 | void Fatal(string msg, params object[] args); 17 | void Fatal(string msg, Exception err, params object[] args); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Utility/MapOptions.cs: -------------------------------------------------------------------------------- 1 | using AsyncMiddleWare.Context; 2 | using AsyncMiddleWare.Utility; 3 | using System; 4 | 5 | namespace AsyncMiddleWare.Utility 6 | { 7 | internal class MapOptions 8 | { 9 | public CallDelegate Branch { get; set; } 10 | public PathString PathMatch { get; set; } 11 | } 12 | internal class MapWhenOptions 13 | { 14 | private Predicate _predicate; 15 | public Predicate Predicate 16 | { 17 | get 18 | { 19 | return _predicate; 20 | } 21 | set 22 | { 23 | if (value == null) 24 | { 25 | throw new ArgumentNullException(nameof(value)); 26 | } 27 | 28 | _predicate = value; 29 | } 30 | } 31 | public CallDelegate Branch { get; set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /AsyncMiddleWare.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsyncMiddleWare", "src\AsyncMiddleWare.csproj", "{0B4DEFCB-2ED0-4E90-897C-F3BE90FB0E80}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {0B4DEFCB-2ED0-4E90-897C-F3BE90FB0E80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {0B4DEFCB-2ED0-4E90-897C-F3BE90FB0E80}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {0B4DEFCB-2ED0-4E90-897C-F3BE90FB0E80}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {0B4DEFCB-2ED0-4E90-897C-F3BE90FB0E80}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /src/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("AsyncMiddleWare")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("AsyncMiddleWare")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | //将 ComVisible 设置为 false 将使此程序集中的类型 18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("0b4defcb-2ed0-4e90-897c-f3be90fb0e80")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/CallBuilder.cs: -------------------------------------------------------------------------------- 1 | using AsyncMiddleWare.Logger; 2 | using AsyncMiddleWare.Utility; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | 8 | namespace AsyncMiddleWare 9 | { 10 | public sealed partial class CallBuilder 11 | { 12 | private IList> middlewareList = new List>(); 13 | private static Task CompletedTask = Task.FromResult(false); 14 | private CallDelegate _last = (context) => 15 | { 16 | return CompletedTask; 17 | }; 18 | private ILoggerFactory loggerFactory = null; 19 | public CallBuilder(ILoggerFactory loggerFactory) 20 | { 21 | this.loggerFactory = loggerFactory; 22 | } 23 | public CallDelegate Build() 24 | { 25 | CallDelegate callDelegate = _last; 26 | foreach(var m in middlewareList.Reverse()) 27 | { 28 | callDelegate = m(callDelegate); 29 | } 30 | return CallProxy = callDelegate; 31 | } 32 | public CallDelegate CallProxy 33 | { 34 | get; 35 | private set; 36 | } 37 | public ILoggerFactory LoggerFactory 38 | { 39 | get 40 | { 41 | return loggerFactory; 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/NLog.config: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | 14 | 18 | 19 | 20 | 25 | 26 | 31 | 32 | 33 | 34 | 35 | 36 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/Logger/NLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AsyncMiddleWare.Logger 4 | { 5 | public sealed class NLogger : ILogger 6 | { 7 | private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); 8 | 9 | public Type AttachParent 10 | { 11 | get; 12 | internal set; 13 | } 14 | 15 | public void Debug(string msg, params object[] args) 16 | { 17 | logger.Debug(msg, args); 18 | } 19 | 20 | public void Debug(string msg, Exception err, params object[] args) 21 | { 22 | logger.Debug(err, msg, args); 23 | } 24 | 25 | public void Info(string msg, params object[] args) 26 | { 27 | logger.Info(msg, args); 28 | } 29 | 30 | public void Info(string msg, Exception err, params object[] args) 31 | { 32 | logger.Info(err, msg, args); 33 | } 34 | 35 | public void Trace(string msg, params object[] args) 36 | { 37 | logger.Trace(msg, args); 38 | } 39 | 40 | public void Trace(string msg, Exception err, params object[] args) 41 | { 42 | logger.Trace(err, msg, args); 43 | } 44 | 45 | public void Error(string msg, params object[] args) 46 | { 47 | logger.Error(msg, args); 48 | } 49 | 50 | public void Error(string msg, Exception err, params object[] args) 51 | { 52 | logger.Error(err, msg, args); 53 | } 54 | 55 | public void Fatal(string msg, params object[] args) 56 | { 57 | logger.Fatal(msg, args); 58 | } 59 | 60 | public void Fatal(string msg, Exception err, params object[] args) 61 | { 62 | logger.Fatal(err, msg, args); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/MapExtensions.cs: -------------------------------------------------------------------------------- 1 | using AsyncMiddleWare.Context; 2 | using AsyncMiddleWare.Utility; 3 | using System; 4 | 5 | namespace AsyncMiddleWare 6 | { 7 | public partial class CallBuilder 8 | { 9 | public CallBuilder Map(PathString pathMatch, Action configuration) 10 | { 11 | if (configuration == null) 12 | { 13 | throw new ArgumentNullException(nameof(configuration)); 14 | } 15 | if (pathMatch.HasValue && pathMatch.Value.EndsWith("/", StringComparison.Ordinal)) 16 | { 17 | throw new ArgumentException("The path must not end with a '/'", nameof(pathMatch)); 18 | } 19 | var branchBuilder = New(); 20 | configuration(branchBuilder); 21 | var branch = branchBuilder.Build(); 22 | var options = new MapOptions 23 | { 24 | Branch = branch, 25 | PathMatch = pathMatch 26 | }; 27 | return Use(next => new MapMiddleware(next, options).Invoke); 28 | } 29 | public CallBuilder MapWhen(Predicate predicate, Action configuration) 30 | { 31 | if (predicate == null) 32 | { 33 | throw new ArgumentNullException(nameof(configuration)); 34 | } 35 | if (configuration == null) 36 | { 37 | throw new ArgumentNullException(nameof(configuration)); 38 | } 39 | var branchBuilder = New(); 40 | configuration(branchBuilder); 41 | var branch = branchBuilder.Build(); 42 | var options = new MapWhenOptions 43 | { 44 | Predicate = predicate, 45 | Branch = branch 46 | }; 47 | return Use(next => new MapWhenMiddleware(next, options).Invoke); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/UseExtensions.cs: -------------------------------------------------------------------------------- 1 | using AsyncMiddleWare.Context; 2 | using AsyncMiddleWare.Logger; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | 7 | namespace AsyncMiddleWare 8 | { 9 | public delegate Task CallDelegate(CallContext context); 10 | public partial class CallBuilder 11 | { 12 | public CallBuilder UseMiddleware() 13 | { 14 | var type = typeof(T); 15 | 16 | if (!typeof(MiddlewareBase).IsAssignableFrom(type)) 17 | throw new ArgumentException($"{type.Name}不是有效的MiddlewareBase类型"); 18 | return this.Use((next) => 19 | { 20 | var constructor = type.GetConstructor(new[] { typeof(CallDelegate), typeof(ILoggerFactory) }); 21 | var middleware = (MiddlewareBase)constructor.Invoke(new object[] { next, loggerFactory }); 22 | return middleware.Invoke; 23 | }); 24 | } 25 | 26 | public CallBuilder Use(Func fun) 27 | { 28 | middlewareList.Add(fun); 29 | return this; 30 | } 31 | 32 | public CallBuilder Use(Func fun) 33 | { 34 | Func func = (next) => 35 | { 36 | return new CallDelegate((context) => 37 | { 38 | return fun(context, next); 39 | }); 40 | }; 41 | return this.Use(func); 42 | } 43 | 44 | public CallBuilder Run(Func last) 45 | { 46 | Func func = (next) => 47 | { 48 | return new CallDelegate(last); 49 | }; 50 | return this.Use(func); 51 | } 52 | 53 | public CallBuilder New() 54 | { 55 | return new CallBuilder(loggerFactory); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Utility/PathStringHelper.cs: -------------------------------------------------------------------------------- 1 | namespace AsyncMiddleWare.Utility 2 | { 3 | internal class PathStringHelper 4 | { 5 | private static bool[] ValidPathChars = { 6 | false, false, false, false, false, false, false, false, // 0x00 - 0x07 7 | false, false, false, false, false, false, false, false, // 0x08 - 0x0F 8 | false, false, false, false, false, false, false, false, // 0x10 - 0x17 9 | false, false, false, false, false, false, false, false, // 0x18 - 0x1F 10 | false, true, false, false, true, false, true, true, // 0x20 - 0x27 11 | true, true, true, true, true, true, true, true, // 0x28 - 0x2F 12 | true, true, true, true, true, true, true, true, // 0x30 - 0x37 13 | true, true, true, true, false, true, false, false, // 0x38 - 0x3F 14 | true, true, true, true, true, true, true, true, // 0x40 - 0x47 15 | true, true, true, true, true, true, true, true, // 0x48 - 0x4F 16 | true, true, true, true, true, true, true, true, // 0x50 - 0x57 17 | true, true, true, false, false, false, false, true, // 0x58 - 0x5F 18 | false, true, true, true, true, true, true, true, // 0x60 - 0x67 19 | true, true, true, true, true, true, true, true, // 0x68 - 0x6F 20 | true, true, true, true, true, true, true, true, // 0x70 - 0x77 21 | true, true, true, false, false, false, true, false, // 0x78 - 0x7F 22 | }; 23 | 24 | public static bool IsValidPathChar(char c) 25 | { 26 | return c < ValidPathChars.Length && ValidPathChars[c]; 27 | } 28 | 29 | public static bool IsPercentEncodedChar(string str, int index) 30 | { 31 | return index < str.Length - 2 32 | && str[index] == '%' 33 | && IsHexadecimalChar(str[index + 1]) 34 | && IsHexadecimalChar(str[index + 2]); 35 | } 36 | 37 | public static bool IsHexadecimalChar(char c) 38 | { 39 | return ('0' <= c && c <= '9') 40 | || ('A' <= c && c <= 'F') 41 | || ('a' <= c && c <= 'f'); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Utility/MapMiddleware.cs: -------------------------------------------------------------------------------- 1 | using AsyncMiddleWare.Context; 2 | using AsyncMiddleWare.Utility; 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | namespace AsyncMiddleWare.Utility 7 | { 8 | internal class MapMiddleware 9 | { 10 | protected readonly CallDelegate _next; 11 | protected readonly MapOptions _options; 12 | public MapMiddleware(CallDelegate next, MapOptions options) 13 | { 14 | if (next == null) 15 | { 16 | throw new ArgumentNullException(nameof(next)); 17 | } 18 | 19 | if (options == null) 20 | { 21 | throw new ArgumentNullException(nameof(options)); 22 | } 23 | this._next = next; 24 | this._options = options; 25 | } 26 | public async Task Invoke(CallContext context) 27 | { 28 | if (context == null) 29 | throw new ArgumentNullException(nameof(context)); 30 | PathString path = context.Path; 31 | if (path.StartsWithSegments(_options.PathMatch)) 32 | { 33 | try 34 | { 35 | await _options.Branch(context); 36 | } 37 | catch 38 | { 39 | 40 | } 41 | } 42 | else 43 | { 44 | await _next(context); 45 | } 46 | } 47 | } 48 | internal class MapWhenMiddleware 49 | { 50 | protected readonly CallDelegate _next; 51 | protected readonly MapWhenOptions _options; 52 | public MapWhenMiddleware(CallDelegate next, MapWhenOptions options) 53 | { 54 | if (next == null) 55 | { 56 | throw new ArgumentNullException(nameof(next)); 57 | } 58 | 59 | if (options == null) 60 | { 61 | throw new ArgumentNullException(nameof(options)); 62 | } 63 | this._next = next; 64 | this._options = options; 65 | } 66 | public async Task Invoke(CallContext context) 67 | { 68 | if (context == null) 69 | throw new ArgumentNullException(nameof(context)); 70 | if (_options.Predicate(context)) 71 | { 72 | await _options.Branch(context); 73 | } 74 | else 75 | { 76 | await _next(context); 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/Program.cs: -------------------------------------------------------------------------------- 1 | using AsyncMiddleWare.Context; 2 | using AsyncMiddleWare.Logger; 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | namespace AsyncMiddleWare 7 | { 8 | public class Middleware1 : MiddlewareBase 9 | { 10 | public Middleware1(CallDelegate next, ILoggerFactory loggerFactory) : base(next, loggerFactory) 11 | { 12 | } 13 | 14 | public override async Task Invoke(CallContext context) 15 | { 16 | this._logger.Info("call begin from Middleware1 " + DateTime.Now.ToString("HH:mm:ss")); 17 | await this._next(context); 18 | this._logger.Info("call end from Middleware1 " + DateTime.Now.ToString("HH:mm:ss")); 19 | } 20 | } 21 | 22 | public class Middleware2 : MiddlewareBase 23 | { 24 | public Middleware2(CallDelegate next, ILoggerFactory loggerFactory) : base(next, loggerFactory) 25 | { 26 | } 27 | 28 | public override async Task Invoke(CallContext context) 29 | { 30 | this._logger.Info("call begin from Middleware2 " + DateTime.Now.ToString("HH:mm:ss")); 31 | await this._next(context); 32 | this._logger.Info("call end from Middleware2 " + DateTime.Now.ToString("HH:mm:ss")); 33 | } 34 | } 35 | 36 | public class Middleware3 : MiddlewareBase 37 | { 38 | public Middleware3(CallDelegate next, ILoggerFactory loggerFactory) : base(next, loggerFactory) 39 | { 40 | } 41 | 42 | public override async Task Invoke(CallContext context) 43 | { 44 | this._logger.Info("call begin from Middleware3 " + DateTime.Now.ToString("HH:mm:ss")); 45 | await this._next(context); 46 | this._logger.Info("call end from Middleware3 " + DateTime.Now.ToString("HH:mm:ss")); 47 | } 48 | } 49 | 50 | class Program 51 | { 52 | static void Main(string[] args) 53 | { 54 | CallBuilder builder = new CallBuilder(new NLoggerFactory()); 55 | builder.UseMiddleware(); 56 | builder.UseMiddleware(); 57 | builder.UseMiddleware(); 58 | builder.Use(async (context, next) => 59 | { 60 | await Console.Out.WriteLineAsync("Call before next."); 61 | await next(context); 62 | await Console.Out.WriteLineAsync("Call after next."); 63 | }); 64 | builder.Run(async (context) => 65 | { 66 | await Console.Out.WriteLineAsync("hello world!"); 67 | }); 68 | var calldelegate = builder.Build(); 69 | var task = calldelegate(new CallContext()); 70 | task.Wait(); 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /src/AsyncMiddleWare.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {0B4DEFCB-2ED0-4E90-897C-F3BE90FB0E80} 8 | Exe 9 | Properties 10 | AsyncMiddleWare 11 | AsyncMiddleWare 12 | v4.5 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | ..\packages\NLog.4.4.12\lib\net45\NLog.dll 37 | True 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | Always 69 | 70 | 71 | Designer 72 | 73 | 74 | 75 | 76 | 83 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # MSTest test Results 33 | [Tt]est[Rr]esult*/ 34 | [Bb]uild[Ll]og.* 35 | 36 | # NUNIT 37 | *.VisualState.xml 38 | TestResult.xml 39 | 40 | # Build Results of an ATL Project 41 | [Dd]ebugPS/ 42 | [Rr]eleasePS/ 43 | dlldata.c 44 | 45 | # .NET Core 46 | project.lock.json 47 | project.fragment.lock.json 48 | artifacts/ 49 | **/Properties/launchSettings.json 50 | 51 | *_i.c 52 | *_p.c 53 | *_i.h 54 | *.ilk 55 | *.meta 56 | *.obj 57 | *.pch 58 | *.pdb 59 | *.pgc 60 | *.pgd 61 | *.rsp 62 | *.sbr 63 | *.tlb 64 | *.tli 65 | *.tlh 66 | *.tmp 67 | *.tmp_proj 68 | *.log 69 | *.vspscc 70 | *.vssscc 71 | .builds 72 | *.pidb 73 | *.svclog 74 | *.scc 75 | 76 | # Chutzpah Test files 77 | _Chutzpah* 78 | 79 | # Visual C++ cache files 80 | ipch/ 81 | *.aps 82 | *.ncb 83 | *.opendb 84 | *.opensdf 85 | *.sdf 86 | *.cachefile 87 | *.VC.db 88 | *.VC.VC.opendb 89 | 90 | # Visual Studio profiler 91 | *.psess 92 | *.vsp 93 | *.vspx 94 | *.sap 95 | 96 | # TFS 2012 Local Workspace 97 | $tf/ 98 | 99 | # Guidance Automation Toolkit 100 | *.gpState 101 | 102 | # ReSharper is a .NET coding add-in 103 | _ReSharper*/ 104 | *.[Rr]e[Ss]harper 105 | *.DotSettings.user 106 | 107 | # JustCode is a .NET coding add-in 108 | .JustCode 109 | 110 | # TeamCity is a build add-in 111 | _TeamCity* 112 | 113 | # DotCover is a Code Coverage Tool 114 | *.dotCover 115 | 116 | # Visual Studio code coverage results 117 | *.coverage 118 | *.coveragexml 119 | 120 | # NCrunch 121 | _NCrunch_* 122 | .*crunch*.local.xml 123 | nCrunchTemp_* 124 | 125 | # MightyMoose 126 | *.mm.* 127 | AutoTest.Net/ 128 | 129 | # Web workbench (sass) 130 | .sass-cache/ 131 | 132 | # Installshield output folder 133 | [Ee]xpress/ 134 | 135 | # DocProject is a documentation generator add-in 136 | DocProject/buildhelp/ 137 | DocProject/Help/*.HxT 138 | DocProject/Help/*.HxC 139 | DocProject/Help/*.hhc 140 | DocProject/Help/*.hhk 141 | DocProject/Help/*.hhp 142 | DocProject/Help/Html2 143 | DocProject/Help/html 144 | 145 | # Click-Once directory 146 | publish/ 147 | 148 | # Publish Web Output 149 | *.[Pp]ublish.xml 150 | *.azurePubxml 151 | # TODO: Comment the next line if you want to checkin your web deploy settings 152 | # but database connection strings (with potential passwords) will be unencrypted 153 | *.pubxml 154 | *.publishproj 155 | 156 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 157 | # checkin your Azure Web App publish settings, but sensitive information contained 158 | # in these scripts will be unencrypted 159 | PublishScripts/ 160 | 161 | # NuGet Packages 162 | *.nupkg 163 | # The packages folder can be ignored because of Package Restore 164 | **/packages/* 165 | # except build/, which is used as an MSBuild target. 166 | !**/packages/build/ 167 | # Uncomment if necessary however generally it will be regenerated when needed 168 | #!**/packages/repositories.config 169 | # NuGet v3's project.json files produces more ignorable files 170 | *.nuget.props 171 | *.nuget.targets 172 | 173 | # Microsoft Azure Build Output 174 | csx/ 175 | *.build.csdef 176 | 177 | # Microsoft Azure Emulator 178 | ecf/ 179 | rcf/ 180 | 181 | # Windows Store app package directories and files 182 | AppPackages/ 183 | BundleArtifacts/ 184 | Package.StoreAssociation.xml 185 | _pkginfo.txt 186 | 187 | # Visual Studio cache files 188 | # files ending in .cache can be ignored 189 | *.[Cc]ache 190 | # but keep track of directories ending in .cache 191 | !*.[Cc]ache/ 192 | 193 | # Others 194 | ClientBin/ 195 | ~$* 196 | *~ 197 | *.dbmdl 198 | *.dbproj.schemaview 199 | *.jfm 200 | *.pfx 201 | *.publishsettings 202 | orleans.codegen.cs 203 | 204 | # Since there are multiple workflows, uncomment next line to ignore bower_components 205 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 206 | #bower_components/ 207 | 208 | # RIA/Silverlight projects 209 | Generated_Code/ 210 | 211 | # Backup & report files from converting an old project file 212 | # to a newer Visual Studio version. Backup files are not needed, 213 | # because we have git ;-) 214 | _UpgradeReport_Files/ 215 | Backup*/ 216 | UpgradeLog*.XML 217 | UpgradeLog*.htm 218 | 219 | # SQL Server files 220 | *.mdf 221 | *.ldf 222 | *.ndf 223 | 224 | # Business Intelligence projects 225 | *.rdl.data 226 | *.bim.layout 227 | *.bim_*.settings 228 | 229 | # Microsoft Fakes 230 | FakesAssemblies/ 231 | 232 | # GhostDoc plugin setting file 233 | *.GhostDoc.xml 234 | 235 | # Node.js Tools for Visual Studio 236 | .ntvs_analysis.dat 237 | node_modules/ 238 | 239 | # Typescript v1 declaration files 240 | typings/ 241 | 242 | # Visual Studio 6 build log 243 | *.plg 244 | 245 | # Visual Studio 6 workspace options file 246 | *.opt 247 | 248 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 249 | *.vbw 250 | 251 | # Visual Studio LightSwitch build output 252 | **/*.HTMLClient/GeneratedArtifacts 253 | **/*.DesktopClient/GeneratedArtifacts 254 | **/*.DesktopClient/ModelManifest.xml 255 | **/*.Server/GeneratedArtifacts 256 | **/*.Server/ModelManifest.xml 257 | _Pvt_Extensions 258 | 259 | # Paket dependency manager 260 | .paket/paket.exe 261 | paket-files/ 262 | 263 | # FAKE - F# Make 264 | .fake/ 265 | 266 | # JetBrains Rider 267 | .idea/ 268 | *.sln.iml 269 | 270 | # CodeRush 271 | .cr/ 272 | 273 | # Python Tools for Visual Studio (PTVS) 274 | __pycache__/ 275 | *.pyc 276 | 277 | # Cake - Uncomment if you are using it 278 | # tools/** 279 | # !tools/packages.config 280 | 281 | # Telerik's JustMock configuration file 282 | *.jmconfig 283 | 284 | # BizTalk build output 285 | *.btp.cs 286 | *.btm.cs 287 | *.odx.cs 288 | *.xsd.cs 289 | -------------------------------------------------------------------------------- /src/Utility/PathString.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | 4 | namespace AsyncMiddleWare.Utility 5 | { 6 | public struct PathString : IEquatable 7 | { 8 | private static readonly PathString Empty = new PathString(string.Empty); 9 | private readonly string _value; 10 | public PathString(string value) 11 | { 12 | if(!string.IsNullOrEmpty(value) && value[0]!='/') 13 | { 14 | throw new ArgumentException("Path must start with slash", nameof(value)); 15 | } 16 | _value = value; 17 | } 18 | public string Value 19 | { 20 | get 21 | { 22 | return _value; 23 | } 24 | } 25 | public bool HasValue 26 | { 27 | get 28 | { 29 | return !string.IsNullOrEmpty(_value); 30 | } 31 | } 32 | public override string ToString() 33 | { 34 | return ToUriComponent(); 35 | } 36 | public string ToUriComponent() 37 | { 38 | if (!HasValue) 39 | { 40 | return string.Empty; 41 | } 42 | 43 | StringBuilder buffer = null; 44 | 45 | var start = 0; 46 | var count = 0; 47 | var requiresEscaping = false; 48 | var i = 0; 49 | 50 | while (i < _value.Length) 51 | { 52 | var isPercentEncodedChar = PathStringHelper.IsPercentEncodedChar(_value, i); 53 | if (PathStringHelper.IsValidPathChar(_value[i]) || isPercentEncodedChar) 54 | { 55 | if (requiresEscaping) 56 | { 57 | // the current segment requires escape 58 | if (buffer == null) 59 | { 60 | buffer = new StringBuilder(_value.Length * 3); 61 | } 62 | 63 | buffer.Append(Uri.EscapeDataString(_value.Substring(start, count))); 64 | 65 | requiresEscaping = false; 66 | start = i; 67 | count = 0; 68 | } 69 | 70 | if (isPercentEncodedChar) 71 | { 72 | count += 3; 73 | i += 3; 74 | } 75 | else 76 | { 77 | count++; 78 | i++; 79 | } 80 | } 81 | else 82 | { 83 | if (!requiresEscaping) 84 | { 85 | // the current segument doesn't require escape 86 | if (buffer == null) 87 | { 88 | buffer = new StringBuilder(_value.Length * 3); 89 | } 90 | 91 | buffer.Append(_value, start, count); 92 | 93 | requiresEscaping = true; 94 | start = i; 95 | count = 0; 96 | } 97 | 98 | count++; 99 | i++; 100 | } 101 | } 102 | 103 | if (count == _value.Length && !requiresEscaping) 104 | { 105 | return _value; 106 | } 107 | else 108 | { 109 | if (count > 0) 110 | { 111 | if (buffer == null) 112 | { 113 | buffer = new StringBuilder(_value.Length * 3); 114 | } 115 | 116 | if (requiresEscaping) 117 | { 118 | buffer.Append(Uri.EscapeDataString(_value.Substring(start, count))); 119 | } 120 | else 121 | { 122 | buffer.Append(_value, start, count); 123 | } 124 | } 125 | 126 | return buffer.ToString(); 127 | } 128 | } 129 | public static PathString FromUriComponent(string uriComponent) 130 | { 131 | return new PathString(Uri.UnescapeDataString(uriComponent)); 132 | } 133 | public static PathString FromUriComponent(Uri uri) 134 | { 135 | if(uri==null) 136 | { 137 | throw new ArgumentNullException(nameof(uri)); 138 | } 139 | return new PathString("/" + uri.GetComponents(UriComponents.Path, UriFormat.Unescaped)); 140 | } 141 | public bool StartsWithSegments(PathString other) 142 | { 143 | return StartsWithSegments(other, StringComparison.OrdinalIgnoreCase); 144 | } 145 | public bool StartsWithSegments(PathString other, StringComparison comparisonType) 146 | { 147 | var value1 = Value ?? string.Empty; 148 | var value2 = other.Value ?? string.Empty; 149 | if (value1.StartsWith(value2, comparisonType)) 150 | { 151 | return value1.Length == value2.Length || value1[value2.Length] == '/'; 152 | } 153 | return false; 154 | } 155 | public bool StartsWithSegments(PathString other, out PathString remaining) 156 | { 157 | return StartsWithSegments(other, StringComparison.OrdinalIgnoreCase, out remaining); 158 | } 159 | public bool StartsWithSegments(PathString other, StringComparison comparisonType, out PathString remaining) 160 | { 161 | var value1 = Value ?? string.Empty; 162 | var value2 = other.Value ?? string.Empty; 163 | if (value1.StartsWith(value2, comparisonType)) 164 | { 165 | if (value1.Length == value2.Length || value1[value2.Length] == '/') 166 | { 167 | remaining = new PathString(value1.Substring(value2.Length)); 168 | return true; 169 | } 170 | } 171 | remaining = Empty; 172 | return false; 173 | } 174 | public bool StartsWithSegments(PathString other, out PathString matched, out PathString remaining) 175 | { 176 | return StartsWithSegments(other, StringComparison.OrdinalIgnoreCase, out matched, out remaining); 177 | } 178 | public bool StartsWithSegments(PathString other, StringComparison comparisonType, out PathString matched, out PathString remaining) 179 | { 180 | var value1 = Value ?? string.Empty; 181 | var value2 = other.Value ?? string.Empty; 182 | if (value1.StartsWith(value2, comparisonType)) 183 | { 184 | if (value1.Length == value2.Length || value1[value2.Length] == '/') 185 | { 186 | matched = new PathString(value1.Substring(0, value2.Length)); 187 | remaining = new PathString(value1.Substring(value2.Length)); 188 | return true; 189 | } 190 | } 191 | remaining = Empty; 192 | matched = Empty; 193 | return false; 194 | } 195 | public PathString Add(PathString other) 196 | { 197 | if (HasValue && 198 | other.HasValue && 199 | Value[Value.Length - 1] == '/') 200 | { 201 | // If the path string has a trailing slash and the other string has a leading slash, we need 202 | // to trim one of them. 203 | return new PathString(Value + other.Value.Substring(1)); 204 | } 205 | 206 | return new PathString(Value + other.Value); 207 | } 208 | public bool Equals(PathString other) 209 | { 210 | return Equals(other, StringComparison.OrdinalIgnoreCase); 211 | } 212 | public bool Equals(PathString other, StringComparison comparisonType) 213 | { 214 | if (!HasValue && !other.HasValue) 215 | { 216 | return true; 217 | } 218 | return string.Equals(_value, other._value, comparisonType); 219 | } 220 | public override bool Equals(object obj) 221 | { 222 | if (ReferenceEquals(null, obj)) 223 | { 224 | return !HasValue; 225 | } 226 | return obj is PathString && Equals((PathString)obj); 227 | } 228 | public override int GetHashCode() 229 | { 230 | return (HasValue ? StringComparer.OrdinalIgnoreCase.GetHashCode(_value) : 0); 231 | } 232 | public static bool operator ==(PathString left, PathString right) 233 | { 234 | return left.Equals(right); 235 | } 236 | public static bool operator !=(PathString left, PathString right) 237 | { 238 | return !left.Equals(right); 239 | } 240 | public static string operator +(string left, PathString right) 241 | { 242 | // This overload exists to prevent the implicit string<->PathString converter from 243 | // trying to call the PathString+PathString operator for things that are not path strings. 244 | return string.Concat(left, right.ToString()); 245 | } 246 | public static string operator +(PathString left, string right) 247 | { 248 | // This overload exists to prevent the implicit string<->PathString converter from 249 | // trying to call the PathString+PathString operator for things that are not path strings. 250 | return string.Concat(left.ToString(), right); 251 | } 252 | public static PathString operator +(PathString left, PathString right) 253 | { 254 | return left.Add(right); 255 | } 256 | public static implicit operator PathString(string s) 257 | { 258 | return ConvertFromString(s); 259 | } 260 | public static implicit operator string(PathString path) 261 | { 262 | return path.ToString(); 263 | } 264 | internal static PathString ConvertFromString(string s) 265 | { 266 | return string.IsNullOrEmpty(s) ? new PathString(s) : FromUriComponent(s); 267 | } 268 | } 269 | } 270 | -------------------------------------------------------------------------------- /src/NLog.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Watch config file for changes and reload automatically. 16 | 17 | 18 | 19 | 20 | Print internal NLog messages to the console. Default value is: false 21 | 22 | 23 | 24 | 25 | Print internal NLog messages to the console error output. Default value is: false 26 | 27 | 28 | 29 | 30 | Write internal NLog messages to the specified file. 31 | 32 | 33 | 34 | 35 | Log level threshold for internal log messages. Default value is: Info. 36 | 37 | 38 | 39 | 40 | Global log level threshold for application log messages. Messages below this level won't be logged.. 41 | 42 | 43 | 44 | 45 | Throw an exception when there is an internal error. Default value is: false. 46 | 47 | 48 | 49 | 50 | Throw an exception when there is a configuration error. If not set, determined by throwExceptions. 51 | 52 | 53 | 54 | 55 | Gets or sets a value indicating whether Variables should be kept on configuration reload. Default value is: false. 56 | 57 | 58 | 59 | 60 | Write internal NLog messages to the System.Diagnostics.Trace. Default value is: false. 61 | 62 | 63 | 64 | 65 | Write timestamps for internal NLog messages. Default value is: true. 66 | 67 | 68 | 69 | 70 | Use InvariantCulture as default culture instead of CurrentCulture. Default value is: false. 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | Make all targets within this section asynchronous (creates additional threads but the calling thread isn't blocked by any target writes). 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | Prefix for targets/layout renderers/filters/conditions loaded from this assembly. 102 | 103 | 104 | 105 | 106 | Load NLog extensions from the specified file (*.dll) 107 | 108 | 109 | 110 | 111 | Load NLog extensions from the specified assembly. Assembly name should be fully qualified. 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | Name of the logger. May include '*' character which acts like a wildcard. Allowed forms are: *, Name, *Name, Name* and *Name* 122 | 123 | 124 | 125 | 126 | Comma separated list of levels that this rule matches. 127 | 128 | 129 | 130 | 131 | Minimum level that this rule matches. 132 | 133 | 134 | 135 | 136 | Maximum level that this rule matches. 137 | 138 | 139 | 140 | 141 | Level that this rule matches. 142 | 143 | 144 | 145 | 146 | Comma separated list of target names. 147 | 148 | 149 | 150 | 151 | Ignore further rules if this one matches. 152 | 153 | 154 | 155 | 156 | Enable or disable logging rule. Disabled rules are ignored. 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | Name of the file to be included. You could use * wildcard. The name is relative to the name of the current config file. 199 | 200 | 201 | 202 | 203 | Ignore any errors in the include file. 204 | 205 | 206 | 207 | 208 | 209 | 210 | Variable name. 211 | 212 | 213 | 214 | 215 | Variable value. 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | Name of the target. 283 | 284 | 285 | 286 | 287 | Number of log events that should be processed in a batch by the lazy writer thread. 288 | 289 | 290 | 291 | 292 | Limit of full s to write before yielding into Performance is better when writing many small batches, than writing a single large batch 293 | 294 | 295 | 296 | 297 | Action to be taken when the lazy writer thread request queue count exceeds the set limit. 298 | 299 | 300 | 301 | 302 | Limit on the number of requests in the lazy writer thread request queue. 303 | 304 | 305 | 306 | 307 | Time in milliseconds to sleep between batches. 308 | 309 | 310 | 311 | 312 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | Name of the target. 337 | 338 | 339 | 340 | 341 | Delay the flush until the LogEvent has been confirmed as written 342 | 343 | 344 | 345 | 346 | Condition expression. Log events who meet this condition will cause a flush on the wrapped target. 347 | 348 | 349 | 350 | 351 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | Name of the target. 370 | 371 | 372 | 373 | 374 | Number of log events to be buffered. 375 | 376 | 377 | 378 | 379 | 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. 380 | 381 | 382 | 383 | 384 | Indicates whether to use sliding timeout. 385 | 386 | 387 | 388 | 389 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | Name of the target. 426 | 427 | 428 | 429 | 430 | Encoding to be used. 431 | 432 | 433 | 434 | 435 | Instance of that is used to format log messages. 436 | 437 | 438 | 439 | 440 | End of line value if a newline is appended at the end of log message . 441 | 442 | 443 | 444 | 445 | Maximum message size in bytes. 446 | 447 | 448 | 449 | 450 | Indicates whether to append newline at the end of log message. 451 | 452 | 453 | 454 | 455 | Action that should be taken if the will be more connections than . 456 | 457 | 458 | 459 | 460 | Action that should be taken if the message is larger than maxMessageSize. 461 | 462 | 463 | 464 | 465 | Maximum current connections. 0 = no maximum. 466 | 467 | 468 | 469 | 470 | Indicates whether to keep connection open whenever possible. 471 | 472 | 473 | 474 | 475 | Size of the connection cache (number of connections which are kept alive). 476 | 477 | 478 | 479 | 480 | Network address. 481 | 482 | 483 | 484 | 485 | Maximum queue size. 486 | 487 | 488 | 489 | 490 | Indicates whether to include stack contents. 491 | 492 | 493 | 494 | 495 | Indicates whether to include source info (file name and line number) in the information sent over the network. 496 | 497 | 498 | 499 | 500 | Indicates whether to include NLog-specific extensions to log4j schema. 501 | 502 | 503 | 504 | 505 | Indicates whether to include dictionary contents. 506 | 507 | 508 | 509 | 510 | Indicates whether to include call site (class and method name) in the information sent over the network. 511 | 512 | 513 | 514 | 515 | AppInfo field. By default it's the friendly name of the current AppDomain. 516 | 517 | 518 | 519 | 520 | NDC item separator. 521 | 522 | 523 | 524 | 525 | Indicates whether to include dictionary contents. 526 | 527 | 528 | 529 | 530 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | Layout that should be use to calcuate the value for the parameter. 558 | 559 | 560 | 561 | 562 | Viewer parameter name. 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | Name of the target. 585 | 586 | 587 | 588 | 589 | Text to be rendered. 590 | 591 | 592 | 593 | 594 | Header. 595 | 596 | 597 | 598 | 599 | Footer. 600 | 601 | 602 | 603 | 604 | Indicates whether to use default row highlighting rules. 605 | 606 | 607 | 608 | 609 | Indicates whether to auto-check if the console is available. - Disables console writing if Environment.UserInteractive = False (Windows Service) - Disables console writing if Console Standard Input is not available (Non-Console-App) 610 | 611 | 612 | 613 | 614 | The encoding for writing messages to the . 615 | 616 | 617 | 618 | 619 | Indicates whether the error stream (stderr) should be used instead of the output stream (stdout). 620 | 621 | 622 | 623 | 624 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | Condition that must be met in order to set the specified foreground and background color. 660 | 661 | 662 | 663 | 664 | Background color. 665 | 666 | 667 | 668 | 669 | Foreground color. 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | Indicates whether to ignore case when comparing texts. 686 | 687 | 688 | 689 | 690 | Regular expression to be matched. You must specify either text or regex. 691 | 692 | 693 | 694 | 695 | Text to be matched. You must specify either text or regex. 696 | 697 | 698 | 699 | 700 | Indicates whether to match whole words only. 701 | 702 | 703 | 704 | 705 | Compile the ? This can improve the performance, but at the costs of more memory usage. If false, the Regex Cache is used. 706 | 707 | 708 | 709 | 710 | Background color. 711 | 712 | 713 | 714 | 715 | Foreground color. 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | Name of the target. 735 | 736 | 737 | 738 | 739 | Text to be rendered. 740 | 741 | 742 | 743 | 744 | Header. 745 | 746 | 747 | 748 | 749 | Footer. 750 | 751 | 752 | 753 | 754 | Indicates whether to send the log messages to the standard error instead of the standard output. 755 | 756 | 757 | 758 | 759 | Indicates whether to auto-check if the console is available - Disables console writing if Environment.UserInteractive = False (Windows Service) - Disables console writing if Console Standard Input is not available (Non-Console-App) 760 | 761 | 762 | 763 | 764 | The encoding for writing messages to the . 765 | 766 | 767 | 768 | 769 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | Name of the target. 800 | 801 | 802 | 803 | 804 | Obsolete - value will be ignored! The logging code always runs outside of transaction. Gets or sets a value indicating whether to use database transactions. Some data providers require this. 805 | 806 | 807 | 808 | 809 | Database user name. If the ConnectionString is not provided this value will be used to construct the "User ID=" part of the connection string. 810 | 811 | 812 | 813 | 814 | Name of the database provider. 815 | 816 | 817 | 818 | 819 | Database password. If the ConnectionString is not provided this value will be used to construct the "Password=" part of the connection string. 820 | 821 | 822 | 823 | 824 | Indicates whether to keep the database connection open between the log events. 825 | 826 | 827 | 828 | 829 | Database name. If the ConnectionString is not provided this value will be used to construct the "Database=" part of the connection string. 830 | 831 | 832 | 833 | 834 | Name of the connection string (as specified in <connectionStrings> configuration section. 835 | 836 | 837 | 838 | 839 | Connection string. When provided, it overrides the values specified in DBHost, DBUserName, DBPassword, DBDatabase. 840 | 841 | 842 | 843 | 844 | Database host name. If the ConnectionString is not provided this value will be used to construct the "Server=" part of the connection string. 845 | 846 | 847 | 848 | 849 | Connection string using for installation and uninstallation. If not provided, regular ConnectionString is being used. 850 | 851 | 852 | 853 | 854 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 855 | 856 | 857 | 858 | 859 | Text of the SQL command to be run on each log level. 860 | 861 | 862 | 863 | 864 | Type of the SQL command to be run on each log level. 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | Type of the command. 888 | 889 | 890 | 891 | 892 | Connection string to run the command against. If not provided, connection string from the target is used. 893 | 894 | 895 | 896 | 897 | Indicates whether to ignore failures. 898 | 899 | 900 | 901 | 902 | Command text. 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | Layout that should be use to calcuate the value for the parameter. 917 | 918 | 919 | 920 | 921 | Database parameter name. 922 | 923 | 924 | 925 | 926 | Database parameter precision. 927 | 928 | 929 | 930 | 931 | Database parameter scale. 932 | 933 | 934 | 935 | 936 | Database parameter size. 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | 952 | Name of the target. 953 | 954 | 955 | 956 | 957 | Text to be rendered. 958 | 959 | 960 | 961 | 962 | Header. 963 | 964 | 965 | 966 | 967 | Footer. 968 | 969 | 970 | 971 | 972 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | Name of the target. 989 | 990 | 991 | 992 | 993 | Layout used to format log messages. 994 | 995 | 996 | 997 | 998 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | Name of the target. 1024 | 1025 | 1026 | 1027 | 1028 | Layout used to format log messages. 1029 | 1030 | 1031 | 1032 | 1033 | Layout that renders event Category. 1034 | 1035 | 1036 | 1037 | 1038 | Layout that renders event ID. 1039 | 1040 | 1041 | 1042 | 1043 | Name of the Event Log to write to. This can be System, Application or any user-defined name. 1044 | 1045 | 1046 | 1047 | 1048 | Name of the machine on which Event Log service is running. 1049 | 1050 | 1051 | 1052 | 1053 | Value to be used as the event Source. 1054 | 1055 | 1056 | 1057 | 1058 | Action to take if the message is larger than the option. 1059 | 1060 | 1061 | 1062 | 1063 | Optional entrytype. When not set, or when not convertable to then determined by 1064 | 1065 | 1066 | 1067 | 1068 | Maximum Event log size in kilobytes. If null, the value won't be set. Default is 512 Kilobytes as specified by Eventlog API 1069 | 1070 | 1071 | 1072 | 1073 | Message length limit to write to the Event Log. 1074 | 1075 | 1076 | 1077 | 1078 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1099 | 1100 | 1101 | Name of the target. 1102 | 1103 | 1104 | 1105 | 1106 | Indicates whether to return to the first target after any successful write. 1107 | 1108 | 1109 | 1110 | 1111 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 1112 | 1113 | 1114 | 1115 | 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | 1153 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1162 | Name of the target. 1163 | 1164 | 1165 | 1166 | 1167 | Text to be rendered. 1168 | 1169 | 1170 | 1171 | 1172 | Header. 1173 | 1174 | 1175 | 1176 | 1177 | Footer. 1178 | 1179 | 1180 | 1181 | 1182 | File encoding. 1183 | 1184 | 1185 | 1186 | 1187 | Line ending mode. 1188 | 1189 | 1190 | 1191 | 1192 | Way file archives are numbered. 1193 | 1194 | 1195 | 1196 | 1197 | Name of the file to be used for an archive. 1198 | 1199 | 1200 | 1201 | 1202 | Indicates whether to automatically archive log files every time the specified time passes. 1203 | 1204 | 1205 | 1206 | 1207 | Size in bytes above which log files will be automatically archived. Warning: combining this with isn't supported. We cannot create multiple archive files, if they should have the same name. Choose: 1208 | 1209 | 1210 | 1211 | 1212 | Indicates whether to compress archive files into the zip archive format. 1213 | 1214 | 1215 | 1216 | 1217 | Maximum number of archive files that should be kept. 1218 | 1219 | 1220 | 1221 | 1222 | Gets or set a value indicating whether a managed file stream is forced, instead of using the native implementation. 1223 | 1224 | 1225 | 1226 | 1227 | Is the an absolute or relative path? 1228 | 1229 | 1230 | 1231 | 1232 | Cleanup invalid values in a filename, e.g. slashes in a filename. If set to true, this can impact the performance of massive writes. If set to false, nothing gets written when the filename is wrong. 1233 | 1234 | 1235 | 1236 | 1237 | Whether or not this target should just discard all data that its asked to write. Mostly used for when testing NLog Stack except final write 1238 | 1239 | 1240 | 1241 | 1242 | Is the an absolute or relative path? 1243 | 1244 | 1245 | 1246 | 1247 | Value indicationg whether file creation calls should be synchronized by a system global mutex. 1248 | 1249 | 1250 | 1251 | 1252 | Maximum number of log filenames that should be stored as existing. 1253 | 1254 | 1255 | 1256 | 1257 | Indicates whether the footer should be written only when the file is archived. 1258 | 1259 | 1260 | 1261 | 1262 | Name of the file to write to. 1263 | 1264 | 1265 | 1266 | 1267 | Value specifying the date format to use when archiving files. 1268 | 1269 | 1270 | 1271 | 1272 | Indicates whether to archive old log file on startup. 1273 | 1274 | 1275 | 1276 | 1277 | Indicates whether to create directories if they do not exist. 1278 | 1279 | 1280 | 1281 | 1282 | File attributes (Windows only). 1283 | 1284 | 1285 | 1286 | 1287 | Indicates whether to delete old log file on startup. 1288 | 1289 | 1290 | 1291 | 1292 | Indicates whether to replace file contents on each write instead of appending log message at the end. 1293 | 1294 | 1295 | 1296 | 1297 | Indicates whether to enable log file(s) to be deleted. 1298 | 1299 | 1300 | 1301 | 1302 | Number of times the write is appended on the file before NLog discards the log message. 1303 | 1304 | 1305 | 1306 | 1307 | Indicates whether concurrent writes to the log file by multiple processes on the same host. 1308 | 1309 | 1310 | 1311 | 1312 | Indicates whether to keep log file open instead of opening and closing it on each logging event. 1313 | 1314 | 1315 | 1316 | 1317 | Indicates whether concurrent writes to the log file by multiple processes on different network hosts. 1318 | 1319 | 1320 | 1321 | 1322 | 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). 1323 | 1324 | 1325 | 1326 | 1327 | 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. 1328 | 1329 | 1330 | 1331 | 1332 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 1333 | 1334 | 1335 | 1336 | 1337 | Log file buffer size in bytes. 1338 | 1339 | 1340 | 1341 | 1342 | Indicates whether to automatically flush the file buffers after each log message. 1343 | 1344 | 1345 | 1346 | 1347 | Delay in milliseconds to wait before attempting to write to the file again. 1348 | 1349 | 1350 | 1351 | 1352 | 1353 | 1354 | 1355 | 1356 | 1357 | 1358 | 1359 | 1360 | 1361 | 1362 | 1363 | 1364 | 1365 | 1366 | 1367 | 1368 | 1369 | 1370 | 1371 | 1372 | 1373 | 1374 | 1375 | 1376 | 1377 | 1378 | 1379 | 1380 | 1381 | 1382 | 1383 | 1384 | 1385 | 1386 | 1387 | 1388 | 1389 | 1390 | 1391 | 1392 | 1393 | 1394 | 1395 | 1396 | 1397 | 1398 | 1399 | 1400 | 1401 | 1402 | 1403 | 1404 | 1405 | 1406 | 1407 | 1408 | 1409 | 1410 | 1411 | 1412 | 1413 | 1414 | 1415 | Name of the target. 1416 | 1417 | 1418 | 1419 | 1420 | Condition expression. Log events who meet this condition will be forwarded to the wrapped target. 1421 | 1422 | 1423 | 1424 | 1425 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 1426 | 1427 | 1428 | 1429 | 1430 | 1431 | 1432 | 1433 | 1434 | 1435 | 1436 | 1437 | 1438 | 1439 | 1440 | 1441 | 1442 | 1443 | 1444 | 1445 | 1446 | 1447 | Name of the target. 1448 | 1449 | 1450 | 1451 | 1452 | Windows domain name to change context to. 1453 | 1454 | 1455 | 1456 | 1457 | Required impersonation level. 1458 | 1459 | 1460 | 1461 | 1462 | Type of the logon provider. 1463 | 1464 | 1465 | 1466 | 1467 | Logon Type. 1468 | 1469 | 1470 | 1471 | 1472 | User account password. 1473 | 1474 | 1475 | 1476 | 1477 | Indicates whether to revert to the credentials of the process instead of impersonating another user. 1478 | 1479 | 1480 | 1481 | 1482 | Username to change context to. 1483 | 1484 | 1485 | 1486 | 1487 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 1488 | 1489 | 1490 | 1491 | 1492 | 1493 | 1494 | 1495 | 1496 | 1497 | 1498 | 1499 | 1500 | 1501 | 1502 | 1503 | 1504 | 1505 | 1506 | 1507 | 1508 | 1509 | 1510 | 1511 | 1512 | 1513 | 1514 | 1515 | 1516 | 1517 | 1518 | 1519 | 1520 | 1521 | 1522 | 1523 | 1524 | 1525 | 1526 | 1527 | Name of the target. 1528 | 1529 | 1530 | 1531 | 1532 | Interval in which messages will be written up to the number of messages. 1533 | 1534 | 1535 | 1536 | 1537 | Maximum allowed number of messages written per . 1538 | 1539 | 1540 | 1541 | 1542 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 1543 | 1544 | 1545 | 1546 | 1547 | 1548 | 1549 | 1550 | 1551 | 1552 | 1553 | 1554 | 1555 | 1556 | 1557 | 1558 | 1559 | 1560 | 1561 | 1562 | 1563 | 1564 | Name of the target. 1565 | 1566 | 1567 | 1568 | 1569 | Endpoint address. 1570 | 1571 | 1572 | 1573 | 1574 | Name of the endpoint configuration in WCF configuration file. 1575 | 1576 | 1577 | 1578 | 1579 | Indicates whether to use a WCF service contract that is one way (fire and forget) or two way (request-reply) 1580 | 1581 | 1582 | 1583 | 1584 | Client ID. 1585 | 1586 | 1587 | 1588 | 1589 | Indicates whether to include per-event properties in the payload sent to the server. 1590 | 1591 | 1592 | 1593 | 1594 | Indicates whether to use binary message encoding. 1595 | 1596 | 1597 | 1598 | 1599 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 1600 | 1601 | 1602 | 1603 | 1604 | 1605 | 1606 | 1607 | 1608 | 1609 | 1610 | 1611 | 1612 | 1613 | 1614 | Layout that should be use to calculate the value for the parameter. 1615 | 1616 | 1617 | 1618 | 1619 | Name of the parameter. 1620 | 1621 | 1622 | 1623 | 1624 | Type of the parameter. 1625 | 1626 | 1627 | 1628 | 1629 | Type of the parameter. Obsolete alias for 1630 | 1631 | 1632 | 1633 | 1634 | 1635 | 1636 | 1637 | 1638 | 1639 | 1640 | 1641 | 1642 | 1643 | 1644 | 1645 | 1646 | 1647 | 1648 | 1649 | 1650 | 1651 | 1652 | 1653 | 1654 | 1655 | 1656 | 1657 | 1658 | 1659 | 1660 | 1661 | 1662 | 1663 | 1664 | 1665 | 1666 | Name of the target. 1667 | 1668 | 1669 | 1670 | 1671 | Text to be rendered. 1672 | 1673 | 1674 | 1675 | 1676 | Header. 1677 | 1678 | 1679 | 1680 | 1681 | Footer. 1682 | 1683 | 1684 | 1685 | 1686 | Indicates whether to send message as HTML instead of plain text. 1687 | 1688 | 1689 | 1690 | 1691 | Encoding to be used for sending e-mail. 1692 | 1693 | 1694 | 1695 | 1696 | Indicates whether to add new lines between log entries. 1697 | 1698 | 1699 | 1700 | 1701 | CC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). 1702 | 1703 | 1704 | 1705 | 1706 | Recipients' email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). 1707 | 1708 | 1709 | 1710 | 1711 | BCC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). 1712 | 1713 | 1714 | 1715 | 1716 | Mail message body (repeated for each log message send in one mail). 1717 | 1718 | 1719 | 1720 | 1721 | Mail subject. 1722 | 1723 | 1724 | 1725 | 1726 | Sender's email address (e.g. joe@domain.com). 1727 | 1728 | 1729 | 1730 | 1731 | Indicates the SMTP client timeout. 1732 | 1733 | 1734 | 1735 | 1736 | Priority used for sending mails. 1737 | 1738 | 1739 | 1740 | 1741 | Indicates whether NewLine characters in the body should be replaced with tags. 1742 | 1743 | 1744 | 1745 | 1746 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 1747 | 1748 | 1749 | 1750 | 1751 | SMTP Server to be used for sending. 1752 | 1753 | 1754 | 1755 | 1756 | SMTP Authentication mode. 1757 | 1758 | 1759 | 1760 | 1761 | Username used to connect to SMTP server (used when SmtpAuthentication is set to "basic"). 1762 | 1763 | 1764 | 1765 | 1766 | Password used to authenticate against SMTP server (used when SmtpAuthentication is set to "basic"). 1767 | 1768 | 1769 | 1770 | 1771 | Indicates whether SSL (secure sockets layer) should be used when communicating with SMTP server. 1772 | 1773 | 1774 | 1775 | 1776 | Port number that SMTP Server is listening on. 1777 | 1778 | 1779 | 1780 | 1781 | Indicates whether the default Settings from System.Net.MailSettings should be used. 1782 | 1783 | 1784 | 1785 | 1786 | Folder where applications save mail messages to be processed by the local SMTP server. 1787 | 1788 | 1789 | 1790 | 1791 | Specifies how outgoing email messages will be handled. 1792 | 1793 | 1794 | 1795 | 1796 | 1797 | 1798 | 1799 | 1800 | 1801 | 1802 | 1803 | 1804 | 1805 | 1806 | 1807 | 1808 | 1809 | 1810 | 1811 | 1812 | 1813 | 1814 | 1815 | 1816 | 1817 | 1818 | 1819 | 1820 | 1821 | Name of the target. 1822 | 1823 | 1824 | 1825 | 1826 | Layout used to format log messages. 1827 | 1828 | 1829 | 1830 | 1831 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 1832 | 1833 | 1834 | 1835 | 1836 | 1837 | 1838 | 1839 | 1840 | 1841 | 1842 | 1843 | 1844 | 1845 | 1846 | 1847 | 1848 | 1849 | 1850 | 1851 | 1852 | 1853 | 1854 | Name of the target. 1855 | 1856 | 1857 | 1858 | 1859 | Layout used to format log messages. 1860 | 1861 | 1862 | 1863 | 1864 | Encoding to be used when writing text to the queue. 1865 | 1866 | 1867 | 1868 | 1869 | Indicates whether to use the XML format when serializing message. This will also disable creating queues. 1870 | 1871 | 1872 | 1873 | 1874 | Indicates whether to check if a queue exists before writing to it. 1875 | 1876 | 1877 | 1878 | 1879 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 1880 | 1881 | 1882 | 1883 | 1884 | Indicates whether to create the queue if it doesn't exists. 1885 | 1886 | 1887 | 1888 | 1889 | Label to associate with each message. 1890 | 1891 | 1892 | 1893 | 1894 | Name of the queue to write to. 1895 | 1896 | 1897 | 1898 | 1899 | Indicates whether to use recoverable messages (with guaranteed delivery). 1900 | 1901 | 1902 | 1903 | 1904 | 1905 | 1906 | 1907 | 1908 | 1909 | 1910 | 1911 | 1912 | 1913 | 1914 | 1915 | 1916 | 1917 | Name of the target. 1918 | 1919 | 1920 | 1921 | 1922 | Class name. 1923 | 1924 | 1925 | 1926 | 1927 | Method name. The method must be public and static. Use the AssemblyQualifiedName , https://msdn.microsoft.com/en-us/library/system.type.assemblyqualifiedname(v=vs.110).aspx e.g. 1928 | 1929 | 1930 | 1931 | 1932 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 1933 | 1934 | 1935 | 1936 | 1937 | 1938 | 1939 | 1940 | 1941 | 1942 | 1943 | 1944 | 1945 | 1946 | 1947 | 1948 | 1949 | 1950 | 1951 | 1952 | 1953 | 1954 | 1955 | 1956 | 1957 | 1958 | 1959 | Name of the target. 1960 | 1961 | 1962 | 1963 | 1964 | Layout used to format log messages. 1965 | 1966 | 1967 | 1968 | 1969 | Encoding to be used. 1970 | 1971 | 1972 | 1973 | 1974 | End of line value if a newline is appended at the end of log message . 1975 | 1976 | 1977 | 1978 | 1979 | Maximum message size in bytes. 1980 | 1981 | 1982 | 1983 | 1984 | Indicates whether to append newline at the end of log message. 1985 | 1986 | 1987 | 1988 | 1989 | Action that should be taken if the will be more connections than . 1990 | 1991 | 1992 | 1993 | 1994 | Action that should be taken if the message is larger than maxMessageSize. 1995 | 1996 | 1997 | 1998 | 1999 | Network address. 2000 | 2001 | 2002 | 2003 | 2004 | Size of the connection cache (number of connections which are kept alive). 2005 | 2006 | 2007 | 2008 | 2009 | Indicates whether to keep connection open whenever possible. 2010 | 2011 | 2012 | 2013 | 2014 | Maximum current connections. 0 = no maximum. 2015 | 2016 | 2017 | 2018 | 2019 | Maximum queue size. 2020 | 2021 | 2022 | 2023 | 2024 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 2025 | 2026 | 2027 | 2028 | 2029 | 2030 | 2031 | 2032 | 2033 | 2034 | 2035 | 2036 | 2037 | 2038 | 2039 | 2040 | 2041 | 2042 | 2043 | 2044 | 2045 | 2046 | 2047 | 2048 | 2049 | 2050 | 2051 | 2052 | 2053 | 2054 | 2055 | 2056 | 2057 | 2058 | 2059 | 2060 | Name of the target. 2061 | 2062 | 2063 | 2064 | 2065 | Encoding to be used. 2066 | 2067 | 2068 | 2069 | 2070 | Instance of that is used to format log messages. 2071 | 2072 | 2073 | 2074 | 2075 | End of line value if a newline is appended at the end of log message . 2076 | 2077 | 2078 | 2079 | 2080 | Maximum message size in bytes. 2081 | 2082 | 2083 | 2084 | 2085 | Indicates whether to append newline at the end of log message. 2086 | 2087 | 2088 | 2089 | 2090 | Action that should be taken if the will be more connections than . 2091 | 2092 | 2093 | 2094 | 2095 | Action that should be taken if the message is larger than maxMessageSize. 2096 | 2097 | 2098 | 2099 | 2100 | Maximum current connections. 0 = no maximum. 2101 | 2102 | 2103 | 2104 | 2105 | Indicates whether to keep connection open whenever possible. 2106 | 2107 | 2108 | 2109 | 2110 | Size of the connection cache (number of connections which are kept alive). 2111 | 2112 | 2113 | 2114 | 2115 | Network address. 2116 | 2117 | 2118 | 2119 | 2120 | Maximum queue size. 2121 | 2122 | 2123 | 2124 | 2125 | Indicates whether to include stack contents. 2126 | 2127 | 2128 | 2129 | 2130 | Indicates whether to include source info (file name and line number) in the information sent over the network. 2131 | 2132 | 2133 | 2134 | 2135 | Indicates whether to include NLog-specific extensions to log4j schema. 2136 | 2137 | 2138 | 2139 | 2140 | Indicates whether to include dictionary contents. 2141 | 2142 | 2143 | 2144 | 2145 | Indicates whether to include call site (class and method name) in the information sent over the network. 2146 | 2147 | 2148 | 2149 | 2150 | AppInfo field. By default it's the friendly name of the current AppDomain. 2151 | 2152 | 2153 | 2154 | 2155 | NDC item separator. 2156 | 2157 | 2158 | 2159 | 2160 | Indicates whether to include dictionary contents. 2161 | 2162 | 2163 | 2164 | 2165 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 2166 | 2167 | 2168 | 2169 | 2170 | 2171 | 2172 | 2173 | 2174 | 2175 | 2176 | 2177 | 2178 | 2179 | 2180 | 2181 | 2182 | Name of the target. 2183 | 2184 | 2185 | 2186 | 2187 | Layout used to format log messages. 2188 | 2189 | 2190 | 2191 | 2192 | Indicates whether to perform layout calculation. 2193 | 2194 | 2195 | 2196 | 2197 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 2198 | 2199 | 2200 | 2201 | 2202 | 2203 | 2204 | 2205 | 2206 | 2207 | 2208 | 2209 | 2210 | 2211 | 2212 | 2213 | Name of the target. 2214 | 2215 | 2216 | 2217 | 2218 | Layout used to format log messages. 2219 | 2220 | 2221 | 2222 | 2223 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 2224 | 2225 | 2226 | 2227 | 2228 | 2229 | 2230 | 2231 | 2232 | 2233 | 2234 | 2235 | 2236 | 2237 | 2238 | 2239 | 2240 | 2241 | 2242 | 2243 | 2244 | 2245 | Name of the target. 2246 | 2247 | 2248 | 2249 | 2250 | Indicates whether performance counter should be automatically created. 2251 | 2252 | 2253 | 2254 | 2255 | Name of the performance counter category. 2256 | 2257 | 2258 | 2259 | 2260 | Counter help text. 2261 | 2262 | 2263 | 2264 | 2265 | Name of the performance counter. 2266 | 2267 | 2268 | 2269 | 2270 | Performance counter type. 2271 | 2272 | 2273 | 2274 | 2275 | The value by which to increment the counter. 2276 | 2277 | 2278 | 2279 | 2280 | Performance counter instance name. 2281 | 2282 | 2283 | 2284 | 2285 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 2286 | 2287 | 2288 | 2289 | 2290 | 2291 | 2292 | 2293 | 2294 | 2295 | 2296 | 2297 | 2298 | 2299 | 2300 | 2301 | 2302 | 2303 | 2304 | 2305 | 2306 | 2307 | 2308 | 2309 | 2310 | 2311 | 2312 | 2313 | 2314 | 2315 | 2316 | 2317 | 2318 | 2319 | 2320 | 2321 | 2322 | 2323 | 2324 | 2325 | 2326 | 2327 | 2328 | 2329 | 2330 | 2331 | 2332 | 2333 | 2334 | Name of the target. 2335 | 2336 | 2337 | 2338 | 2339 | Default filter to be applied when no specific rule matches. 2340 | 2341 | 2342 | 2343 | 2344 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 2345 | 2346 | 2347 | 2348 | 2349 | 2350 | 2351 | 2352 | 2353 | 2354 | 2355 | 2356 | 2357 | Condition to be tested. 2358 | 2359 | 2360 | 2361 | 2362 | Resulting filter to be applied when the condition matches. 2363 | 2364 | 2365 | 2366 | 2367 | 2368 | 2369 | 2370 | 2371 | 2372 | 2373 | 2374 | 2375 | Name of the target. 2376 | 2377 | 2378 | 2379 | 2380 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 2381 | 2382 | 2383 | 2384 | 2385 | 2386 | 2387 | 2388 | 2389 | 2390 | 2391 | 2392 | 2393 | 2394 | 2395 | 2396 | Name of the target. 2397 | 2398 | 2399 | 2400 | 2401 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 2402 | 2403 | 2404 | 2405 | 2406 | Number of times to repeat each log message. 2407 | 2408 | 2409 | 2410 | 2411 | 2412 | 2413 | 2414 | 2415 | 2416 | 2417 | 2418 | 2419 | 2420 | 2421 | 2422 | 2423 | Name of the target. 2424 | 2425 | 2426 | 2427 | 2428 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 2429 | 2430 | 2431 | 2432 | 2433 | Number of retries that should be attempted on the wrapped target in case of a failure. 2434 | 2435 | 2436 | 2437 | 2438 | Time to wait between retries in milliseconds. 2439 | 2440 | 2441 | 2442 | 2443 | 2444 | 2445 | 2446 | 2447 | 2448 | 2449 | 2450 | 2451 | 2452 | 2453 | Name of the target. 2454 | 2455 | 2456 | 2457 | 2458 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 2459 | 2460 | 2461 | 2462 | 2463 | 2464 | 2465 | 2466 | 2467 | 2468 | 2469 | 2470 | 2471 | 2472 | 2473 | Name of the target. 2474 | 2475 | 2476 | 2477 | 2478 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 2479 | 2480 | 2481 | 2482 | 2483 | 2484 | 2485 | 2486 | 2487 | 2488 | 2489 | 2490 | 2491 | 2492 | 2493 | 2494 | Name of the target. 2495 | 2496 | 2497 | 2498 | 2499 | Layout used to format log messages. 2500 | 2501 | 2502 | 2503 | 2504 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 2505 | 2506 | 2507 | 2508 | 2509 | 2510 | 2511 | 2512 | 2513 | 2514 | 2515 | 2516 | 2517 | 2518 | 2519 | 2520 | 2521 | 2522 | 2523 | 2524 | 2525 | 2526 | 2527 | 2528 | 2529 | 2530 | 2531 | 2532 | Name of the target. 2533 | 2534 | 2535 | 2536 | 2537 | Should we include the BOM (Byte-order-mark) for UTF? Influences the property. This will only work for UTF-8. 2538 | 2539 | 2540 | 2541 | 2542 | Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit 2543 | 2544 | 2545 | 2546 | 2547 | Encoding. 2548 | 2549 | 2550 | 2551 | 2552 | Value whether escaping be done according to the old NLog style (Very non-standard) 2553 | 2554 | 2555 | 2556 | 2557 | Value whether escaping be done according to Rfc3986 (Supports Internationalized Resource Identifiers - IRIs) 2558 | 2559 | 2560 | 2561 | 2562 | Web service method name. Only used with Soap. 2563 | 2564 | 2565 | 2566 | 2567 | Web service namespace. Only used with Soap. 2568 | 2569 | 2570 | 2571 | 2572 | Indicates whether to pre-authenticate the HttpWebRequest (Requires 'Authorization' in parameters) 2573 | 2574 | 2575 | 2576 | 2577 | Protocol to be used when calling web service. 2578 | 2579 | 2580 | 2581 | 2582 | Web service URL. 2583 | 2584 | 2585 | 2586 | 2587 | Name of the root XML element, if POST of XML document chosen. If so, this property must not be null. (see and ). 2588 | 2589 | 2590 | 2591 | 2592 | (optional) root namespace of the XML document, if POST of XML document chosen. (see and ). 2593 | 2594 | 2595 | 2596 | 2597 | 2598 | 2599 | 2600 | 2601 | 2602 | 2603 | 2604 | 2605 | 2606 | 2607 | 2608 | 2609 | 2610 | 2611 | 2612 | 2613 | 2614 | 2615 | 2616 | 2617 | 2618 | 2619 | 2620 | 2621 | 2622 | 2623 | 2624 | 2625 | 2626 | 2627 | 2628 | 2629 | 2630 | 2631 | 2632 | 2633 | 2634 | 2635 | 2636 | Footer layout. 2637 | 2638 | 2639 | 2640 | 2641 | Header layout. 2642 | 2643 | 2644 | 2645 | 2646 | Body layout (can be repeated multiple times). 2647 | 2648 | 2649 | 2650 | 2651 | Custom column delimiter value (valid when ColumnDelimiter is set to 'Custom'). 2652 | 2653 | 2654 | 2655 | 2656 | Column delimiter. 2657 | 2658 | 2659 | 2660 | 2661 | Quote Character. 2662 | 2663 | 2664 | 2665 | 2666 | Quoting mode. 2667 | 2668 | 2669 | 2670 | 2671 | Indicates whether CVS should include header. 2672 | 2673 | 2674 | 2675 | 2676 | 2677 | 2678 | 2679 | 2680 | 2681 | 2682 | 2683 | 2684 | 2685 | 2686 | 2687 | 2688 | 2689 | 2690 | 2691 | 2692 | 2693 | 2694 | 2695 | 2696 | 2697 | 2698 | 2699 | 2700 | 2701 | 2702 | Layout of the column. 2703 | 2704 | 2705 | 2706 | 2707 | Name of the column. 2708 | 2709 | 2710 | 2711 | 2712 | 2713 | 2714 | 2715 | 2716 | 2717 | 2718 | 2719 | 2720 | 2721 | 2722 | 2723 | 2724 | 2725 | List of property names to exclude when is true 2726 | 2727 | 2728 | 2729 | 2730 | Option to include all properties from the log events 2731 | 2732 | 2733 | 2734 | 2735 | Indicates whether to include contents of the dictionary. 2736 | 2737 | 2738 | 2739 | 2740 | Option to render the empty object value {} 2741 | 2742 | 2743 | 2744 | 2745 | Option to suppress the extra spaces in the output json 2746 | 2747 | 2748 | 2749 | 2750 | Indicates whether to include contents of the dictionary. 2751 | 2752 | 2753 | 2754 | 2755 | 2756 | 2757 | 2758 | 2759 | 2760 | 2761 | 2762 | 2763 | 2764 | 2765 | Determines wether or not this attribute will be Json encoded. 2766 | 2767 | 2768 | 2769 | 2770 | Indicates whether to escape non-ascii characters 2771 | 2772 | 2773 | 2774 | 2775 | Layout that will be rendered as the attribute's value. 2776 | 2777 | 2778 | 2779 | 2780 | Name of the attribute. 2781 | 2782 | 2783 | 2784 | 2785 | 2786 | 2787 | 2788 | 2789 | 2790 | 2791 | 2792 | 2793 | 2794 | Footer layout. 2795 | 2796 | 2797 | 2798 | 2799 | Header layout. 2800 | 2801 | 2802 | 2803 | 2804 | Body layout (can be repeated multiple times). 2805 | 2806 | 2807 | 2808 | 2809 | 2810 | 2811 | 2812 | 2813 | 2814 | 2815 | 2816 | 2817 | 2818 | 2819 | 2820 | Option to include all properties from the log events 2821 | 2822 | 2823 | 2824 | 2825 | Indicates whether to include contents of the dictionary. 2826 | 2827 | 2828 | 2829 | 2830 | Indicates whether to include contents of the dictionary. 2831 | 2832 | 2833 | 2834 | 2835 | 2836 | 2837 | 2838 | 2839 | 2840 | 2841 | 2842 | 2843 | 2844 | Layout text. 2845 | 2846 | 2847 | 2848 | 2849 | 2850 | 2851 | 2852 | 2853 | 2854 | 2855 | 2856 | 2857 | 2858 | 2859 | Action to be taken when filter matches. 2860 | 2861 | 2862 | 2863 | 2864 | Condition expression. 2865 | 2866 | 2867 | 2868 | 2869 | 2870 | 2871 | 2872 | 2873 | 2874 | 2875 | 2876 | 2877 | 2878 | 2879 | 2880 | 2881 | 2882 | 2883 | 2884 | 2885 | 2886 | 2887 | 2888 | 2889 | 2890 | Action to be taken when filter matches. 2891 | 2892 | 2893 | 2894 | 2895 | Indicates whether to ignore case when comparing strings. 2896 | 2897 | 2898 | 2899 | 2900 | Layout to be used to filter log messages. 2901 | 2902 | 2903 | 2904 | 2905 | Substring to be matched. 2906 | 2907 | 2908 | 2909 | 2910 | 2911 | 2912 | 2913 | 2914 | 2915 | 2916 | 2917 | 2918 | 2919 | 2920 | 2921 | 2922 | Action to be taken when filter matches. 2923 | 2924 | 2925 | 2926 | 2927 | String to compare the layout to. 2928 | 2929 | 2930 | 2931 | 2932 | Indicates whether to ignore case when comparing strings. 2933 | 2934 | 2935 | 2936 | 2937 | Layout to be used to filter log messages. 2938 | 2939 | 2940 | 2941 | 2942 | 2943 | 2944 | 2945 | 2946 | 2947 | 2948 | 2949 | 2950 | 2951 | 2952 | 2953 | 2954 | Action to be taken when filter matches. 2955 | 2956 | 2957 | 2958 | 2959 | Indicates whether to ignore case when comparing strings. 2960 | 2961 | 2962 | 2963 | 2964 | Layout to be used to filter log messages. 2965 | 2966 | 2967 | 2968 | 2969 | Substring to be matched. 2970 | 2971 | 2972 | 2973 | 2974 | 2975 | 2976 | 2977 | 2978 | 2979 | 2980 | 2981 | 2982 | 2983 | 2984 | 2985 | 2986 | Action to be taken when filter matches. 2987 | 2988 | 2989 | 2990 | 2991 | String to compare the layout to. 2992 | 2993 | 2994 | 2995 | 2996 | Indicates whether to ignore case when comparing strings. 2997 | 2998 | 2999 | 3000 | 3001 | Layout to be used to filter log messages. 3002 | 3003 | 3004 | 3005 | 3006 | 3007 | 3008 | 3009 | 3010 | 3011 | 3012 | 3013 | 3014 | 3015 | 3016 | 3017 | 3018 | 3019 | 3020 | 3021 | 3022 | 3023 | 3024 | Action to be taken when filter matches. 3025 | 3026 | 3027 | 3028 | 3029 | Layout to be used to filter log messages. 3030 | 3031 | 3032 | 3033 | 3034 | Default number of unique filter values to expect, will automatically increase if needed 3035 | 3036 | 3037 | 3038 | 3039 | Append FilterCount to the when an event is no longer filtered 3040 | 3041 | 3042 | 3043 | 3044 | Insert FilterCount value into when an event is no longer filtered 3045 | 3046 | 3047 | 3048 | 3049 | Max number of unique filter values to expect simultaneously 3050 | 3051 | 3052 | 3053 | 3054 | Max length of filter values, will truncate if above limit 3055 | 3056 | 3057 | 3058 | 3059 | Default buffer size for the internal buffers 3060 | 3061 | 3062 | 3063 | 3064 | Reuse internal buffers, and doesn't have to constantly allocate new buffers 3065 | 3066 | 3067 | 3068 | 3069 | How long before a filter expires, and logging is accepted again 3070 | 3071 | 3072 | 3073 | 3074 | 3075 | 3076 | 3077 | 3078 | 3079 | 3080 | 3081 | 3082 | 3083 | 3084 | 3085 | 3086 | 3087 | 3088 | 3089 | 3090 | 3091 | 3092 | 3093 | 3094 | 3095 | 3096 | 3097 | 3098 | 3099 | 3100 | 3101 | 3102 | 3103 | --------------------------------------------------------------------------------