/// <summary>
        /// Display a summary of the run to the user, including locations of any assets.
        /// </summary>
        public static void DisplayRunSummary(LogsharkRequest request)
        {
            // Display logset hash, if relevant.
            if (!String.IsNullOrWhiteSpace(request.RunContext.LogsetHash))
            {
                Log.InfoFormat("Logset hash for this run was '{0}'.", request.RunContext.LogsetHash);
            }

            // Display Postgres output location, if relevant.
            int pluginSuccesses = request.RunContext.PluginResponses.Count(pluginResponse => pluginResponse.SuccessfulExecution);

            if (pluginSuccesses > 0)
            {
                Log.InfoFormat("Plugin backing data was written to Postgres database '{0}\\{1}'.", request.Configuration.PostgresConnectionInfo, request.PostgresDatabaseName);
            }

            // A plugin may run successfully, yet not output a workbook.  We only want to display the workbook output location if at least one workbook was output.
            int workbooksOutput = request.RunContext.PluginResponses.Sum(pluginResponse => pluginResponse.WorkbooksOutput.Count);

            if (workbooksOutput > 0)
            {
                Log.InfoFormat("Plugin workbook output was saved to '{0}'.", PluginExecutor.GetOutputLocation(request.RunId));
            }

            // Display information about any published workbooks, if relevant.
            if (request.PublishWorkbooks && pluginSuccesses > 0)
            {
                Log.Info(WorkbookPublisher.BuildPublishingSummary(request.RunContext.PublishedWorkbooks));
            }
        }
Exemple #2
0
        public virtual string BuildRunSummary()
        {
            var summary = new StringBuilder();

            // Display logset hash, if relevant.
            if (InitializationResult != null && !String.IsNullOrWhiteSpace(InitializationResult.LogsetHash))
            {
                summary.AppendFormat("Logset hash for this run was '{0}'.", InitializationResult.LogsetHash);
            }

            // Display Postgres output location, if relevant.
            if (PluginExecutionResult != null)
            {
                int pluginSuccesses = PluginExecutionResult.PluginResponses.Count(pluginResponse => pluginResponse.SuccessfulExecution);
                if (pluginSuccesses > 0)
                {
                    Request.Configuration.PostgresConnectionInfo.MatchSome(connectionInfo =>
                    {
                        summary.AppendLine();
                        summary.AppendFormat("Plugin backing data was written to Postgres database '{0}\\{1}'.", connectionInfo, Request.PostgresDatabaseName);
                    });
                }

                // A plugin may run successfully, yet not output a workbook.  We only want to display the workbook output location if at least one workbook was output.
                int workbooksOutput = PluginExecutionResult.PluginResponses.Sum(pluginResponse => pluginResponse.WorkbooksOutput.Count);
                if (workbooksOutput > 0)
                {
                    summary.AppendLine();
                    summary.AppendFormat("Plugin workbook output was saved to '{0}'.", PluginExecutor.GetRunOutputDirectory(Request.Configuration.ApplicationOutputDirectory, Request.RunId));
                }

                // Display information about any published workbooks, if relevant.
                if (Request.PublishWorkbooks && pluginSuccesses > 0)
                {
                    var publishedWorkbookResults = PluginExecutionResult.PluginResponses
                                                   .Where(response => response.WorkbooksPublished != null)
                                                   .SelectMany(response => response.WorkbooksPublished)
                                                   .ToList();
                    summary.AppendLine();
                    summary.AppendFormat(WorkbookPublisher.BuildPublishingSummary(publishedWorkbookResults));
                }
            }

            return(summary.ToString());
        }