Added category

This commit is contained in:
2026-01-30 20:45:48 +01:00
parent 04a807df4f
commit f54d40b092
2 changed files with 8 additions and 6 deletions

View File

@@ -71,11 +71,18 @@ public abstract class BatchingLoggerProvider : ILoggerProvider, IDisposable
public bool IsStarted { get; set; }
public bool UseMask { get; set; }
public string Category { get; set; } = "General";
private LoggerSettings _loggerSettings;
/// <summary>
/// Creates a new logger instance for the specified category name.
/// </summary>
/// <param name="categoryName">The category name for messages produced by the logger. Cannot be null.</param>
/// <returns>An <see cref="ILogger"/> instance that logs messages for the specified category.</returns>
public ILogger CreateLogger(string categoryName)
{
Category = categoryName;
return new BatchingLogger(this, categoryName, LoggerSettings);
}

View File

@@ -132,12 +132,7 @@ public static class LogHelper
internal static string FormatMessageWithHeader(
LoggerSettings settings,
ELogType logType,
string message,
DateTime dateTime,
string category = null)
internal static string FormatMessageWithHeader(LoggerSettings settings, ELogType logType, string message, DateTime dateTime, string category = null)
{
if (string.IsNullOrWhiteSpace(message))
{