예제 #1
0
        private async Task SendFailureSummary(bool safeMode, string environment, Exception ex, bool shouldLogToSlack, string fileSystemLoggingDirectory)
        {
            SlackSummary slackSummary = new SlackSummary();
            string       summary      = slackSummary.CreateFailureSummary(environment, DateTime.UtcNow, ex.Message, ex.StackTrace);

            if (shouldLogToSlack)
            {
                MySlackWebClient slackWebClient = new MySlackWebClient(new Configuration.GetAppConfig());
                await slackWebClient.Send(summary);
            }
            else
            {
                FileSystemLogger logger = new FileSystemLogger(new FileSystemConfigProvider(new Configuration.GetAppConfig()));
                logger.WriteSummaryToFileSystem(summary);
            }
        }
예제 #2
0
        private async Task SendSummary(bool safeMode, List <string> backups, string environment, bool shouldLogToSlack, string fileSystemLoggingDirectory)
        {
            SlackSummary slackSummary = new SlackSummary();
            string       summary;

            if (safeMode)
            {
                summary = slackSummary.CreateSummaryForSafeMode(environment, DateTime.UtcNow, backups);
            }
            else
            {
                summary = slackSummary.CreateSummaryForUnsafeMode(environment, DateTime.UtcNow, backups);
            }
            if (shouldLogToSlack)
            {
                MySlackWebClient slackWebClient = new MySlackWebClient(new Configuration.GetAppConfig());
                await slackWebClient.Send(summary);
            }
            else
            {
                FileSystemLogger logger = new FileSystemLogger(new FileSystemConfigProvider(new Configuration.GetAppConfig()));
                logger.WriteSummaryToFileSystem(summary);
            }
        }