本文整理汇总了C#中Common.LogWarning方法的典型用法代码示例。如果您正苦于以下问题:C# Common.LogWarning方法的具体用法?C# Common.LogWarning怎么用?C# Common.LogWarning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common
的用法示例。
在下文中一共展示了Common.LogWarning方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRepository
/// <summary>
/// Creates and returns an aggregate repository using the specified settings
/// </summary>
public static IPackageRepository CreateRepository(ISettings settings, Common.ILogger logger)
{
if (settings == null)
{
throw new ArgumentNullException("settings");
}
if (logger == null)
{
throw new ArgumentNullException("logger");
}
// Load the user and machine-wide settings
logger.LogDebug(UIResources.NG_FetchingConfigFiles);
// Get a package source provider that can use the settings
PackageSourceProvider packageSourceProvider = new PackageSourceProvider(settings);
logger.LogDebug(UIResources.NG_ListingEnablePackageSources);
IEnumerable<PackageSource> enabledSources = packageSourceProvider.GetEnabledPackageSources();
if (!enabledSources.Any())
{
logger.LogWarning(UIResources.NG_NoEnabledPackageSources);
}
else
{
foreach (PackageSource enabledSource in enabledSources)
{
logger.LogDebug(UIResources.NG_ListEnabledPackageSource, enabledSource.Source, enabledSource.IsMachineWide);
}
}
// Create an aggregate repository that uses all of the configured sources
AggregateRepository aggRepo = packageSourceProvider.CreateAggregateRepository(PackageRepositoryFactory.Default,
true /* ignore failing repos. Errors will be logged as warnings. */ );
aggRepo.Logger = new NuGetLoggerAdapter(logger);
return aggRepo;
}