Table of Contents

Class ILogCallExtensions

Namespace
ToSic.Lib.Logging
Assembly
ToSic.Lib.Core.dll

Extensions for ILogCall objects which don't need to return a value.

[PublicApi]
public static class ILogCallExtensions
Inheritance
ILogCallExtensions

Methods

Done(ILogCall)

Complete/close an ILogCall without returning a value.

public static void Done(this ILogCall logCall)

Parameters

logCall ILogCall

The log call or null

Done(ILogCall, string)

Complete/close an ILogCall without returning a value, and also add a message.

public static void Done(this ILogCall logCall, string message)

Parameters

logCall ILogCall

The log call or null

message string

Done<T>(ILogCall, T)

Complete/close an ILogCall without returning a value, and also add a message.

public static T Done<T>(this ILogCall logCall, T exception) where T : Exception

Parameters

logCall ILogCall

The log call or null

exception T

Returns

T

Type Parameters

T

ReturnAndLogIfNull<T>(ILogCall<T>, T)

public static T ReturnAndLogIfNull<T>(this ILogCall<T> logCall, T result)

Parameters

logCall ILogCall<T>
result T

Returns

T

Type Parameters

T

ReturnAndLog<T>(ILogCall<T>, T)

Return a value and log the result as well. Note that if the object supports ICanDump it will use that dump to log it's value.

public static T ReturnAndLog<T>(this ILogCall<T> logCall, T result)

Parameters

logCall ILogCall<T>

The log call or null

result T

Returns

T

Type Parameters

T

ReturnAndLog<T>(ILogCall<T>, T, string)

Return a value and log the result as well + add a message. Note that if the object supports ICanDump it will use that dump to log it's value.

public static T ReturnAndLog<T>(this ILogCall<T> logCall, T result, string message)

Parameters

logCall ILogCall<T>

The log call or null

result T
message string

Returns

T

Type Parameters

T

ReturnAsError<T>(ILogCall<T>, T, string)

Return a value with the standard message "error"

public static T ReturnAsError<T>(this ILogCall<T> logCall, T result, string message = null)

Parameters

logCall ILogCall<T>

The log call or null

result T
message string

Returns

T

Type Parameters

T

ReturnAsOk<T>(ILogCall<T>, T)

Return a value with the standard message "ok"

public static T ReturnAsOk<T>(this ILogCall<T> logCall, T result)

Parameters

logCall ILogCall<T>

The log call or null

result T

Returns

T

Type Parameters

T

ReturnEmpty(ILogCall<string>)

Return true for ILogCall bool objects.

public static string ReturnEmpty(this ILogCall<string> logCall)

Parameters

logCall ILogCall<string>

The log call or null

Returns

string

ReturnEmpty(ILogCall<string>, string)

Return true for ILogCall bool objects.

public static string ReturnEmpty(this ILogCall<string> logCall, string message)

Parameters

logCall ILogCall<string>

The log call or null

message string

Message to add to the log

Returns

string

ReturnFalse(ILogCall<bool>)

Return false for ILogCall bool objects.

public static bool ReturnFalse(this ILogCall<bool> logCall)

Parameters

logCall ILogCall<bool>

The log call or null

Returns

bool

ReturnFalse(ILogCall<bool>, string)

Return false for ILogCall bool objects with a message.

public static bool ReturnFalse(this ILogCall<bool> logCall, string message)

Parameters

logCall ILogCall<bool>

The log call or null

message string

Returns

bool

ReturnNull<T>(ILogCall<T>)

Return a null or the default value (like a zero for int) without further messages.

public static T ReturnNull<T>(this ILogCall<T> logCall)

Parameters

logCall ILogCall<T>

The log call or null

Returns

T

Type Parameters

T

ReturnNull<T>(ILogCall<T>, string)

Return a null or the default value (like a zero for int) with specified message.

public static T ReturnNull<T>(this ILogCall<T> logCall, string message)

Parameters

logCall ILogCall<T>

The log call or null

message string

Message to add to the log

Returns

T

Type Parameters

T

ReturnTrue(ILogCall<bool>)

Return true for ILogCall bool objects.

public static bool ReturnTrue(this ILogCall<bool> logCall)

Parameters

logCall ILogCall<bool>

The log call or null

Returns

bool

ReturnTrue(ILogCall<bool>, string)

Return true for ILogCall bool objects with a message.

public static bool ReturnTrue(this ILogCall<bool> logCall, string message)

Parameters

logCall ILogCall<bool>

The log call or null

message string

Returns

bool

Return<T>(ILogCall<T>, T)

Close the log call and return a specific result, without adding any message.

public static T Return<T>(this ILogCall<T> logCall, T result)

Parameters

logCall ILogCall<T>

The log call or null

result T

The result to return

Returns

T

The result specified

Type Parameters

T

Return<T>(ILogCall<T>, T, string)

Close the log call and return a specific result, without adding any message.

public static T Return<T>(this ILogCall<T> logCall, T result, string message)

Parameters

logCall ILogCall<T>

The log call or null

result T

The result to return

message string

Message to add to the log

Returns

T

The result specified

Type Parameters

T