public void Run() { var startTime = DateTimeOffset.Now; try { try { try { _logger.LogInfo("Working..."); _replicator.Run(); _logger.LogInfo("Done."); } catch { _logger.LogInfo("Done with errors. See the log."); throw; } } catch (AggregateException e) { _logger.LogFatal(AggregateExceptionMessage(e), e); } catch (Exception e) { _logger.LogFatal(e.Message, e); } } finally { _logger.LogInfo("Total time: {0}", DateTimeOffset.Now.Subtract(startTime).ToString()); } }
public Task DoMainAsync(string[] args, CancellationToken cancellationToken) { return(Task.Run(() => _replicator.Run())); }