本文整理汇总了C#中ConsoleLogger.WriteReports方法的典型用法代码示例。如果您正苦于以下问题:C# ConsoleLogger.WriteReports方法的具体用法?C# ConsoleLogger.WriteReports怎么用?C# ConsoleLogger.WriteReports使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConsoleLogger
的用法示例。
在下文中一共展示了ConsoleLogger.WriteReports方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
if (args == null || args.Length < 1)
{
throw new InvalidOperationException("Please pass a valid directory name as the first parameter");
}
var installDir = args[0];
if (!Directory.Exists(installDir))
{
throw new InvalidOperationException("You must pass a valid directory as the first parameter");
}
var directories = new List<string>
{
Path.Combine(installDir, @"ResourceManager\AzureResourceManager\"),
Path.Combine(installDir, @"ServiceManagement\Azure\")
};
var reportsDirectory = Directory.GetCurrentDirectory();
bool logReportsDirectoryWarning = true;
if (args.Length > 1 && Directory.Exists(args[1]))
{
reportsDirectory = args[1];
logReportsDirectoryWarning = false;
}
var logger = new ConsoleLogger(reportsDirectory);
if (logReportsDirectoryWarning)
{
logger.WriteWarning("No logger specified in the second parameter, writing reports to {0}",
reportsDirectory);
}
foreach (var analyzer in Analyzers)
{
analyzer.Logger = logger;
logger.WriteMessage("Executing analyzer: {0}", analyzer.Name);
analyzer.Analyze(directories);
logger.WriteMessage("Processing complete for analyzer: {0}", analyzer.Name);
}
logger.WriteReports();
}