wabbajack/Wabbajack.Common/LoggerExtensions.cs

20 lines
356 B
C#
Raw Permalink Normal View History

2021-12-27 23:15:30 +00:00
using System;
using Microsoft.Extensions.Logging;
namespace Wabbajack.Common;
public static class LoggerExtensions
{
public static void CatchAndLog(this ILogger logger, Action fn)
{
try
{
fn();
}
catch (Exception ex)
{
logger.LogError(ex, "In Catch and log");
}
}
}