From f54d40b092559cbee9743508f1da2268b29b68d1 Mon Sep 17 00:00:00 2001 From: EonaCat Date: Fri, 30 Jan 2026 20:45:48 +0100 Subject: [PATCH] Added category --- .../EonaCatCoreLogger/Internal/BatchingLoggerProvider.cs | 7 +++++++ EonaCat.Logger/Managers/LogHelper.cs | 7 +------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/EonaCat.Logger/EonaCatCoreLogger/Internal/BatchingLoggerProvider.cs b/EonaCat.Logger/EonaCatCoreLogger/Internal/BatchingLoggerProvider.cs index e370c90..07be424 100644 --- a/EonaCat.Logger/EonaCatCoreLogger/Internal/BatchingLoggerProvider.cs +++ b/EonaCat.Logger/EonaCatCoreLogger/Internal/BatchingLoggerProvider.cs @@ -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; + /// + /// Creates a new logger instance for the specified category name. + /// + /// The category name for messages produced by the logger. Cannot be null. + /// An instance that logs messages for the specified category. public ILogger CreateLogger(string categoryName) { + Category = categoryName; return new BatchingLogger(this, categoryName, LoggerSettings); } diff --git a/EonaCat.Logger/Managers/LogHelper.cs b/EonaCat.Logger/Managers/LogHelper.cs index 98e2103..92cf8f6 100644 --- a/EonaCat.Logger/Managers/LogHelper.cs +++ b/EonaCat.Logger/Managers/LogHelper.cs @@ -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)) {