| LoggerSwallowT Method (FuncT) |
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.
Namespace:
NLog
Assembly:
NLog (in NLog.dll) Version: 5.3.4+73d83d3161d31288ca5c554cc50d27b6bed5f28b
Syntax public T Swallow<T>(
Func<T> func
)
Public Function Swallow(Of T) (
func As Func(Of T)
) As T
Dim instance As Logger
Dim func As Func(Of T)
Dim returnValue As T
returnValue = instance.Swallow(func)
abstract Swallow :
func : Func<'T> -> 'T
override Swallow :
func : Func<'T> -> 'T
Parameters
- func
- Type: SystemFuncT
Function to run.
Type Parameters
- T
- Return type of the provided function.
Return Value
Type:
TResult returned by the provided function or the default value of type
T in case of exception.
Implements
ISuppress.Swallow``1(FuncUMP)See Also