using Microsoft.Extensions.Logging; namespace SumaTube.Crosscutting.Logging.Extensions { public static class LoggerExtensions { public static void LogMethodEntry(this ILogger logger, string methodName, params object[] parameters) { logger.LogInformation("Entering method {MethodName} with parameters {@Parameters}", methodName, parameters); } public static void LogMethodExit(this ILogger logger, string methodName, object result = null) { logger.LogInformation("Exiting method {MethodName} with result {@Result}", methodName, result); } public static void LogException(this ILogger logger, Exception exception, string message = null) { logger.LogError(exception, message ?? "An error occurred: {ErrorMessage}", exception.Message); } public static void LogPerformance(this ILogger logger, string operation, long elapsedMilliseconds) { logger.LogInformation("Performance: {Operation} took {ElapsedMilliseconds} ms", operation, elapsedMilliseconds); } } }