public NetLoggerProcessor(NetLoggerOption option) { this.option = option; // Start Console message queue processor _outputThread = new Thread(ProcessLogQueue) { IsBackground = true, Name = "Net logger queue processing thread" }; _outputThread.Start(); }
public NetLoggerProvider(NetLoggerOption option, Func <string, LogLevel, bool> filter, bool includeScopes) { _filter = filter; _includeScopes = includeScopes; _messageQueue = new NetLoggerProcessor(option); }
public NetLoggerProvider(NetLoggerOption option) : this(option, null, false) { }
public static ILoggerFactory AddNetLogger(this ILoggerFactory factory, NetLoggerOption option, Func <string, LogLevel, bool> filter, bool includeScopes) { factory.AddProvider(new NetLoggerProvider(option, filter, includeScopes)); return(factory); }
/// <summary> /// 使用默认的过虑规则启用网络日志记录,默认规则是只记录微软Warning及以上的日志,或非微软Info及以上的日志 /// </summary> /// <param name="factory"></param> /// <param name="option">网络日志配置</param> /// <returns></returns> public static ILoggerFactory AddNetLoggerUseDefaultFilter(this ILoggerFactory factory, NetLoggerOption option) { Func <string, LogLevel, bool> filter = (category, level) => { return((level >= LogLevel.Information && !category.StartsWith("Microsoft")) || (level >= LogLevel.Warning)); }; factory.AddProvider(new NetLoggerProvider(option, filter, false)); return(factory); }
public static ILoggerFactory AddNetLogger(this ILoggerFactory factory, NetLoggerOption option) { factory.AddProvider(new NetLoggerProvider(option)); return(factory); }