mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
20 lines
356 B
C#
20 lines
356 B
C#
|
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");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|