Create a try-catch-finally handler which will automatically log when a method starts and when it completes.
Usage
public async Task DeleteAsync()
{
ILogger logger = Logger.Factory.Get();;
await logger.TryCatchFinallyAsync("DeleteAlerts", async () =>
{
await DeleteAlertsAsync();
});
await logger.TryCatchFinallyAsync("DeleteRequestLogs", async () =>
{
await DeleteRequestLogsAsync();
});
}
Output
[DEBUG] DeleteAlerts > start
@........ DeleteAlertsAsync() executing
[DEBUG] DeleteAlerts > complete
[DEBUG] DeleteRequestLogs > start
@........ DeleteRequestLogsAsync() executing
[ERROR] System.NullReferenceException: Object reference not set to an instance of an object.
[DEBUG] DeleteRequestLogs > complete
Create a try-catch-finally handler which will automatically log when a method starts and when it completes.
Usage
Output