/// <summary> /// Checks if the given <paramref name="level"/> is enabled. /// </summary> /// <param name="mLogSettings">The memory logger settings</param> /// <param name="level">level to be checked.</param> /// <returns><c>true</c> if enabled.</returns> public bool IsEnabled(Microsoft.Extensions.Logging.LogLevel level, MemoryLoggerSettings mLogSettings) { if (mLogSettings.MinLevel != null && level < mLogSettings.MinLevel) { return(false); } if (mLogSettings.Filter != null) { return(mLogSettings.Filter(CategoryName, level)); } return(true); }
/// <summary> /// Initializes a new instance of the <see cref="MemoryLogger"/> class. /// </summary> /// <param name="memoryLoggerSettings">The logger settings <see cref="MemoryLoggerSettings"/></param> public MemoryLoggerProvider(MemoryLoggerSettings memoryLoggerSettings) { _mLogSettings = memoryLoggerSettings ?? throw new ArgumentNullException(nameof(memoryLoggerSettings)); }
/// <summary> /// Constructs the instance of <see cref="MemoryLogger"/> /// </summary> /// <param name="categoryName">The category name.</param> /// <param name="memoryLoggerSettings">The memory logger settings.</param> /// <param name="externalScopeProvider">The scope data provider.</param> public MemoryLogger(string categoryName, MemoryLoggerSettings memoryLoggerSettings, IExternalScopeProvider externalScopeProvider) { CategoryName = categoryName; _settings = memoryLoggerSettings ?? throw new ArgumentNullException(nameof(memoryLoggerSettings)); _scopeProvider = externalScopeProvider ?? throw new ArgumentNullException(nameof(externalScopeProvider)); }