当前位置: 首页>>代码示例>>C#>>正文


C# ILogger.WriteLine方法代码示例

本文整理汇总了C#中ILogger.WriteLine方法的典型用法代码示例。如果您正苦于以下问题:C# ILogger.WriteLine方法的具体用法?C# ILogger.WriteLine怎么用?C# ILogger.WriteLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILogger的用法示例。


在下文中一共展示了ILogger.WriteLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrintTable

        private void PrintTable(SummaryTable table, ILogger logger)
        {
            if (table.FullContent.Length == 0)
            {
                logger.WriteLineError("<pre>There are no benchmarks found</pre>");
                return;
            }

            logger.Write("<pre><code>");
            table.PrintCommonColumns(logger);
            logger.WriteLine("</code></pre>");
            logger.WriteLine();

            logger.WriteLine("<table>");

            logger.Write("<tr>");
            table.PrintLine(table.FullHeader, logger, "<th>", "</th>");
            logger.Write("</tr>");

            foreach (var line in table.FullContent)
            {
                logger.Write("<tr>");
                table.PrintLine(line, logger, "<td>", "</td>");
                logger.Write("</tr>");
            }

            logger.WriteLine("</table>");
        }
开发者ID:yuleyule66,项目名称:BenchmarkDotNet,代码行数:28,代码来源:HtmlExporter.cs

示例2: ExportToLog

        public override void ExportToLog(Summary summary, ILogger logger)
        {
            if (useCodeBlocks)
            {
                logger.WriteLine(codeBlockStart);
            }
            logger = GetRightLogger(logger);
            logger.WriteLine();
            foreach (var infoLine in HostEnvironmentInfo.GetCurrent().ToFormattedString())
            {
                logger.WriteLineInfo(infoLine);
            }
            logger.WriteLineInfo(summary.JobRuntimes);
            logger.WriteLine();

            PrintTable(summary.Table, logger);

            // TODO: move this logic to an analyser
            var benchmarksWithTroubles = summary.Reports.Where(r => !r.GetResultRuns().Any()).Select(r => r.Benchmark).ToList();
            if (benchmarksWithTroubles.Count > 0)
            {
                logger.WriteLine();
                logger.WriteLineError("Benchmarks with issues:");
                foreach (var benchmarkWithTroubles in benchmarksWithTroubles)
                {
                    logger.WriteLineError("  " + benchmarkWithTroubles.DisplayInfo);
                }
            }
        }
开发者ID:alexandrnikitin,项目名称:BenchmarkDotNet,代码行数:29,代码来源:MarkdownExporter.cs

示例3: ExportToLog

        public override void ExportToLog(Summary summary, ILogger logger)
        {
            logger.WriteLine($"<pre><code>{EnvironmentHelper.GetCurrentInfo().ToFormattedString("Host")}</code></pre>");
            logger.WriteLine();

            PrintTable(summary.Table, logger);
        }
开发者ID:omariom,项目名称:BenchmarkDotNet,代码行数:7,代码来源:HtmlExporter.cs

示例4: ExportToLog

 public override void ExportToLog(Summary summary, ILogger logger)
 {
     logger.WriteLine(string.Join(";", columns.Select(c => c.Title)));
     foreach (var report in summary.Reports.Values)
         foreach (var measurement in report.AllMeasurements)
             logger.WriteLine(string.Join(";", columns.Select(column => column.GetValue(summary, report, measurement))));
 }
开发者ID:omariom,项目名称:BenchmarkDotNet,代码行数:7,代码来源:CsvMeasurementsExporter.cs

示例5: ExportToLog

        public override void ExportToLog(Summary summary, ILogger logger)
        {
            logger.Write("<pre><code>");
            logger.WriteLine();
            foreach (var infoLine in HostEnvironmentInfo.GetCurrent().ToFormattedString())
            {
                logger.WriteLine(infoLine);
            }
            logger.Write("</code></pre>");
            logger.WriteLine();

            PrintTable(summary.Table, logger);
        }
开发者ID:yuleyule66,项目名称:BenchmarkDotNet,代码行数:13,代码来源:HtmlExporter.cs

示例6: PrintLine

        public static void PrintLine(this SummaryTable table, string[] line, ILogger logger, string leftDel, string rightDel,
                                     bool highlightRow, bool startOfGroup, bool startOfGroupInBold)
        {
            for (int columnIndex = 0; columnIndex < table.ColumnCount; columnIndex++)
            {
                if (!table.Columns[columnIndex].NeedToShow)
                {
                    continue;
                }

                var text = (startOfGroup && startOfGroupInBold)
                    ? BuildBoldText(table, line, leftDel, rightDel, columnIndex)
                    : BuildStandardText(table, line, leftDel, rightDel, columnIndex);

                if (highlightRow) // write the row in an alternative colour
                {
                    logger.WriteHeader(text);
                }
                else
                {
                    logger.WriteStatistic(text);
                }
            }

            logger.WriteLine();
        }
开发者ID:alexandrnikitin,项目名称:BenchmarkDotNet,代码行数:26,代码来源:SummaryTableExtensions.cs

示例7: PrintCommonColumns

 public static void PrintCommonColumns(this SummaryTable table, ILogger logger)
 {
     var commonColumns = table.Columns.Where(c => !c.NeedToShow && !c.IsDefault).ToArray();
     if (commonColumns.Any())
     {
         var paramsOnLine = 0;
         foreach (var column in commonColumns)
         {
             logger.WriteInfo($"{column.Header}={column.Content[0]}  ");
             paramsOnLine++;
             if (paramsOnLine == 3)
             {
                 logger.WriteLine();
                 paramsOnLine = 0;
             }
         }
         if (paramsOnLine != 0)
             logger.WriteLine();
     }
 }
开发者ID:alexandrnikitin,项目名称:BenchmarkDotNet,代码行数:20,代码来源:SummaryTableExtensions.cs

示例8: DisplayResults

 public void DisplayResults(ILogger logger)
 {
     foreach (var diagnoser in diagnosers)
     {
         // TODO when Diagnosers/Diagnostis are wired up properly, instead of the Type name, 
         // print the name used on the cmd line, i.e. -d=<NAME>
         logger.WriteLineHeader($"// * Diagnostic Output - {diagnoser.GetType().Name} *");
         diagnoser.DisplayResults(logger);
         logger.WriteLine();
     }
 }
开发者ID:redknightlois,项目名称:BenchmarkDotNet,代码行数:11,代码来源:CompositeDiagnoser.cs

示例9: ExportToLog

        public override void ExportToLog(Summary summary, ILogger logger)
        {
            logger.WriteLine(string.Join(";", columns.Select(c => c.Title)));

            foreach (var report in summary.Reports)
            {
                foreach (var measurement in report.AllMeasurements)
                {
                    for (int i = 0; i < columns.Length; )
                    {
                        logger.Write(columns[i].GetValue(summary, report, measurement));

                        if (++i < columns.Length)
                        {
                            logger.Write(";");
                        }
                    }
                    logger.WriteLine();
                }
            }
        }
开发者ID:yuleyule66,项目名称:BenchmarkDotNet,代码行数:21,代码来源:CsvMeasurementsExporter.cs

示例10: ExportToLog

        public override void ExportToLog(Summary summary, ILogger logger)
        {
            logger.WriteLine("....");
            foreach (var infoLine in HostEnvironmentInfo.GetCurrent().ToFormattedString())
            {
                logger.WriteLineInfo(infoLine);
            }
            logger.WriteLineInfo(summary.JobRuntimes);
            logger.WriteLine();

            PrintTable(summary.Table, logger);

            var benchmarksWithTroubles = summary.Reports
                .Where(r => !r.GetResultRuns().Any())
                .Select(r => r.Benchmark)
                .ToList();

            if (benchmarksWithTroubles.Count > 0)
            {
                logger.WriteLine();
                logger.WriteLine("[WARNING]");
                logger.WriteLineError(".Benchmarks with issues");
                logger.WriteLine("====");
                foreach (var benchmarkWithTroubles in benchmarksWithTroubles)
                    logger.WriteLineError("* " + benchmarkWithTroubles.DisplayInfo);
                logger.WriteLine("====");
            }
        }
开发者ID:alexandrnikitin,项目名称:BenchmarkDotNet,代码行数:28,代码来源:AsciiDocExporter.cs

示例11: Start

        public void Start(int pollIntervalInSeconds, IDataAccess dal, ILogger logger)
        {
            while (true) {
                try {
                    var batch = dal.DequeueTransform();

                    if (batch.Count > 0) {
                        var docsToUpsert = new Dictionary<string, string> ();
                        foreach (var rootId in batch) {
                            var allRows = dal.GetRows (rootId);

                            JObject finalDoc = CombineRows (rootId, allRows);

                            if (finalDoc != null) {
                                finalDoc ["_transformed_on"] = DateTime.Now;
                                string doc = JsonConvert.SerializeObject (finalDoc);
                                docsToUpsert.Add (rootId, doc);
                            }
                        }

                        dal.UpsertDocuments(docsToUpsert);

                        logger.WriteLine ("Transformed {0}...", batch.Count);
                    } else {
                        Thread.Sleep (pollIntervalInSeconds * 1000);
                    }

                    _backoff = 1;
                } catch (Exception ex) {
                    if (_backoff < 5) {
                        _backoff++;
                    }
                    logger.WriteLine (ex.ToString ());
                    Debug.WriteLine (ex.ToString ());
                    Thread.Sleep (_backoff * 1000);
                }
            }
        }
开发者ID:NGPVAN,项目名称:dnorml,代码行数:38,代码来源:DocumentTransform.cs

示例12: Start

        public void Start(int pollIntervalInSeconds, IDataAccess dal, ILogger logger)
        {
            while (true)
            {
                var tables = dal.GetAllTables();
                int rc = 0;
                foreach (Table t in tables.OrderByDescending(t => t.Prefetch))
                {
                    try
                    {
                        int rowCount = 0;

                        var changedRows = dal.Extract (t);
                        if(changedRows.Count > 0)  {
                            logger.WriteLine ("Extracting {0} from {1}...", changedRows.Count, t);
                        }

                        foreach (var changedRow in changedRows) {
                            t.MaxExtractedVersion = (byte[])changedRow ["Version"];

                            changedRow ["_extracted_on"] = DateTime.Now;
                            changedRow ["_environment"] = t.Environment;

                            if (t.Prefetch) {
                                // prefetched data needs to be updated in cache when it changes
                                Cache.Set (t.Environment, t.Name, t.GetKey (changedRow), changedRow);
                            }

                            dal.UpsertRow (t, changedRow);
                            dal.PersistVersion (t);

                            rowCount++;
                        }

                        rc += rowCount;

                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                        Debug.WriteLine(ex.ToString());
                    }
                }

                if (rc == 0)
                {
                    Thread.Sleep(pollIntervalInSeconds*1000);
                }
            }
        }
开发者ID:NGPVAN,项目名称:dnorml,代码行数:50,代码来源:Extract.cs

示例13: InstallModLoader

        public static void InstallModLoader(IParkitect parkitect, ILogger logger)
        {
            if (parkitect == null) throw new ArgumentNullException(nameof(parkitect));
            if (logger == null) throw new ArgumentNullException(nameof(logger));

            try
            {
                InstallModLoaderFile(parkitect, "ParkitectNexus.Mod.ModLoader", "dll");
            }
            catch (Exception e)
            {
                logger.WriteLine("Failed to install mod loader.", LogLevel.Warn);
                logger.WriteException(e, LogLevel.Warn);
            }
        }
开发者ID:ParkitectNexus,项目名称:ParkitectNexusClient,代码行数:15,代码来源:Main.cs

示例14: ExportToLog

        public override void ExportToLog(Summary summary, ILogger logger)
        {
            foreach (var line in summary.Table.FullContentWithHeader)
            {
                for (int i = 0; i < line.Length;)
                {
                    logger.Write(CsvHelper.Escape(line[i]));

                    if (++i < line.Length)
                    {
                        logger.Write(separator);
                    }
                }

                logger.WriteLine();
            }
        }
开发者ID:alexandrnikitin,项目名称:BenchmarkDotNet,代码行数:17,代码来源:CsvExporter.cs

示例15: ExportToLog

 public override void ExportToLog(Summary summary, ILogger logger)
 {
     foreach (var report in summary.Reports)
     {
         var runs = report.AllMeasurements;
         var modes = runs.Select(it => it.IterationMode).Distinct();
         logger.WriteLineHeader($"*** {report.Benchmark.DisplayInfo} ***");
         logger.WriteLineHeader("* Raw *");
         foreach (var run in runs)
             logger.WriteLineResult(run.ToStr());
         foreach (var mode in modes)
         {
             logger.WriteLine();
             logger.WriteLineHeader($"* Statistics for {mode}");
             logger.WriteLineStatistic(runs.Where(it => it.IterationMode == mode).GetStatistics().ToTimeStr());
         }
     }
 }
开发者ID:alexandrnikitin,项目名称:BenchmarkDotNet,代码行数:18,代码来源:PlainExporter.cs


注:本文中的ILogger.WriteLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。