<PackageReference Include="NLog" Version="6.1.1" />

NLog.ISuppress

public interface ISuppress
Obsolete and replaced by ILogger with NLog v5.3. Provides an interface to execute System.Actions without surfacing any exceptions raised for that action.
void Swallow(Action action)

Runs the provided action. If the action throws, the exception is logged at Error level. The exception is not propagated outside of this method.

T Swallow<T>(Func<T> func)

Runs the provided function and returns its result. If an exception is thrown, it is logged at Error level. The exception is not propagated outside of this method; a default value is returned instead.

T Swallow<T>(Func<T> func, T fallback)

Runs the provided function and returns its result. If an exception is thrown, it is logged at Error level. The exception is not propagated outside of this method; a fallback value is returned instead.