internal ConsoleLogger(string name, Func <string, LogLevel, bool> filter, bool includeScopes, ConsoleLoggerProcessor loggerProcessor) { if (name == null) { throw new ArgumentNullException(nameof(name)); } Name = name; Filter = filter ?? ((category, logLevel) => true); IncludeScopes = includeScopes; _queueProcessor = loggerProcessor; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { Console = new WindowsLogConsole(); } else { Console = new AnsiLogConsole(new AnsiSystemConsole()); } }
internal ConsoleLogger(string name, Func <string, LogLevel, bool> filter, IExternalScopeProvider scopeProvider, ConsoleLoggerProcessor loggerProcessor) { if (name == null) { throw new ArgumentNullException(nameof(name)); } Name = name; Filter = filter ?? ((category, logLevel) => true); ScopeProvider = scopeProvider; LogToStandardErrorThreshold = LogLevel.None; _queueProcessor = loggerProcessor; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { Console = new WindowsLogConsole(); ErrorConsole = new WindowsLogConsole(stdErr: true); } else { Console = new AnsiLogConsole(new AnsiSystemConsole()); ErrorConsole = new AnsiLogConsole(new AnsiSystemConsole(stdErr: true)); } }
internal ConsoleLogger(string name, Func <string, LogLevel, bool> filter, IExternalScopeProvider scopeProvider, ConsoleLoggerProcessor loggerProcessor) { if (name == null) { throw new ArgumentNullException(nameof(name)); } Name = name; Filter = filter ?? ((category, logLevel) => true);//filter为null时直接返回true,即不进行过滤 ScopeProvider = scopeProvider; _queueProcessor = loggerProcessor; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { Console = new WindowsLogConsole();//*********************************在这里实例化一个Windows平台的System.Console !****************** } else { Console = new AnsiLogConsole(new AnsiSystemConsole()); } }