예제 #1
0
    public static void EditorLogAnalyze()
    {
        LogAnalyzer a = new LogAnalyzer();
        LogReporter r = a.Analyze();

        ShowReportEditorWindow window = (ShowReportEditorWindow)EditorWindow.GetWindow(typeof(ShowReportEditorWindow));

        window.reportText = r.ToString();
    }
        public void DocumentValidator_ValidateSampleXml_ShouldWork()
        {
            var document = new TaxPubDocument();

            document.Xml = "<article><front></front></article>";

            var validator = new DocumentValidator();
            var reporter  = new LogReporter(new ConsoleLogger());

            validator.Validate(document, reporter).Wait();
        }
예제 #3
0
        public override async Task RetrieveResources(SessionHostsStartInfo sessionHostsStartInfo)
        {
            string registryWithImageName = $"{sessionHostsStartInfo.ImageDetails.Registry}/{sessionHostsStartInfo.ImageDetails.ImageName}";
            string imageTag = sessionHostsStartInfo.ImageDetails.ImageTag;
            string username = sessionHostsStartInfo.ImageDetails.Username;
            string password = sessionHostsStartInfo.ImageDetails.Password;

            if (string.IsNullOrEmpty(imageTag))
            {
                imageTag = "latest";
            }

            _logger.LogInformation($"Starting image pull for: {registryWithImageName}:{imageTag}.");
            LogReporter logReporter = new LogReporter(_logger);

            Polly.Retry.AsyncRetryPolicy retryPolicy = Policy
                                                       .Handle <Exception>((Exception e) =>
            {
                _logger.LogError($"Exception encountered when creating image: {e.ToString()}");
                return(true);
            })
                                                       .WaitAndRetryAsync(_maxRetryAttempts, i => TimeSpan.FromMinutes(_createImageRetryTimeMins / _maxRetryAttempts));

            await retryPolicy.ExecuteAsync(async() =>
            {
                await _dockerClient.Images.CreateImageAsync(
                    new ImagesCreateParameters {
                    FromImage = registryWithImageName, Tag = imageTag
                },
                    new AuthConfig()
                {
                    Username = username, Password = password
                },
                    logReporter);

                // Making sure that the image was actually downloaded properly
                // We have seen some cases where Docker Registry API returns 'success' on pull while the image has not been properly downloaded
                IEnumerable <ImagesListResponse> images = await _dockerClient.Images.ListImagesAsync(new ImagesListParameters {
                    All = true
                });
                if (images.All(image => !image.RepoTags.Contains($"{registryWithImageName}:{imageTag}")))
                {
                    throw new ApplicationException("CreateImageAsync is completed but the image doesn't exist");
                }
            });

            _logger.LogEvent(MetricConstants.PullImage, null, new Dictionary <string, double>
            {
                { MetricConstants.DownloadDurationInMilliseconds, logReporter.DownloadSummary?.DurationInMilliseconds ?? 0d },
                { MetricConstants.ExtractDurationInMilliseconds, logReporter.ExtractionSummary?.DurationInMilliseconds ?? 0d },
                { MetricConstants.SizeInBytes, logReporter.DownloadSummary?.TotalSizeInBytes ?? 0d }
            }
                             );
        }
        public void ReportFunctionalLogs()
        {
            string inputDirectory = GetWWWDirectory().TrimEnd('\\') + Path.DirectorySeparatorChar
                                    + "App_Data" + Path.DirectorySeparatorChar
                                    + "Logs";

            string reportDirectory = GetLogReportDirectory();

            LogReporter reporter = new LogReporter(inputDirectory, reportDirectory, "AppLog.xml");

            reporter.Report(GetType().Name + Path.DirectorySeparatorChar + TestName);
        }
예제 #5
0
        private void btnSendError_Click(object sender, EventArgs e)
        {
            var logEventInfo = new VirastyarLogEventInfo(LogLevel.Error, "ExceptionForm", "");

            logEventInfo.Exception = ExceptionToShow;

            if (LogReporter.Send(new[] { logEventInfo }))
            {
                PersianMessageBox.Show("گزارش خطا با موفقیت ارسال شد", MessageBoxIcon.Information);
            }
            Close();
        }
예제 #6
0
    static void Main(string[] args)
    {
        var r1 = new ConsoleReporter();

        sample(r1);
        var r2 = new LogReporter();

        sample(r2);
        var r3 = new MailReporter();

        sample(r3);
    }
        private void LinkLabelViewGatheredInfoLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            string logPath = LogReporter.GetLogPath();
            var    pInfo   = new ProcessStartInfo {
                FileName = logPath, Verb = "Open", UseShellExecute = true
            };

            try
            {
                Process.Start(pInfo);
            }
            catch
            {
                // Ignore
            }
        }
예제 #8
0
        private void DisplayLogEntries()
        {
            consoleOutput.Clear();

            var formatter = _filteredEntries.Filters.SingleLineFormat ? (ILogFormatter) new SingleLineFormatter() : new DefaultFormatter();

            try
            {
                var output = LogReporter.Report(_filteredEntries, new DefaultOutputHandler(_filteredEntries.Filters, formatter));
                consoleOutput.Write((output as DefaultOutputHandler).GetReport());
                consoleOutput.GoToStartOfList();
            }
            catch (Exception ex)
            {
                consoleOutput.Write(string.Concat("There was an error formatting the yalf logs - ", ex.ToString()));
            }
        }
예제 #9
0
 public Client(ICheckerCreator checkerCreator,
               IErrorFinderCreator errorFinderCreator,
               IArchiveFinderCreator archiveFinderCreator,
               IErrorRemoverCreator errorRemoverCreator,
               IGarbageCollectorCreator garbageCollectorCreator,
               IFileAppenderCreator fileAppenderCreator,
               IFtpFileDistributorCreator ftpFileDistributorCreator)
 {
     _checkerCreator            = checkerCreator;
     _errorFinderCreator        = errorFinderCreator;
     _archiveFinderCreator      = archiveFinderCreator;
     _errorRemoverCreator       = errorRemoverCreator;
     _garbageCollectorCreator   = garbageCollectorCreator;
     _fileAppenderCreator       = fileAppenderCreator;
     _ftpFileDistributorCreator = ftpFileDistributorCreator;
     _subject         = new Subject();
     _consoleReporter = new ConsoleReporter(_subject);
     var logReporter = new LogReporter(_subject);
 }
예제 #10
0
        public static string Dump(LogPriority logPriority, LogReport report, int count = 1000)
        {
            string sql =
                $"SELECT TOP {count} created, priority, tag, msg FROM SysLog WHERE Priority >= @priority ORDER BY created DESC";

            using (var q = new SqlStatement(sql, Config.Settings.ConnectionString))
            {
                q.AddParameter("@Priority", logPriority);
                using (var reader = q.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        Environment.ExitCode = 1;
                    }
                    var r = LogReporter.Write(reader, report);
                    return(r);
                }
            }
        }
예제 #11
0
        private void OutputCsvFile()
        {
            String outputPath = this.txtCsvFolder.Text;

            if (!Directory.Exists(outputPath))
            {
                MessageBox.Show(String.Format("Output folder '{0}' does not exist, you need to manually create this first.", outputPath));
                return;
            }

            this.ApplyCurrentFilters();

            outputPath = Path.Combine(outputPath, String.Concat("YalfDump_", this.txtLogContext.Text, ".csv"));

            ILogOutputHandler outputHandler = new CsvFileOutputHandler(_filteredEntries.Filters, new DelimitedValuesFormatter(this.txtLogContext.Text, ","), outputPath);

            LogReporter.Report(_filteredEntries, outputHandler);

            this.txtStatus.Text           = String.Concat(this.txtStatus.Text, Environment.NewLine, "Yalf dump output to '", outputPath, "'.", Environment.NewLine);
            this.txtStatus.SelectionStart = this.txtStatus.Text.Length;

            MessageBox.Show("All done");
        }
        public void ReportFunctionalLogs()
        {
            string inputDirectory = GetWWWDirectory().TrimEnd('\\') + Path.DirectorySeparatorChar
                + "App_Data" + Path.DirectorySeparatorChar
                + "Logs";

            string reportDirectory = GetLogReportDirectory();

            LogReporter reporter = new LogReporter(inputDirectory, reportDirectory, "AppLog.xml");
            reporter.Report(GetType().Name + Path.DirectorySeparatorChar + TestName);
        }