本文整理汇总了C#中IServiceProvider.?.GetLogger方法的典型用法代码示例。如果您正苦于以下问题:C# IServiceProvider.?.GetLogger方法的具体用法?C# IServiceProvider.?.GetLogger怎么用?C# IServiceProvider.?.GetLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServiceProvider
的用法示例。
在下文中一共展示了IServiceProvider.?.GetLogger方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EphemeralXmlRepository
public EphemeralXmlRepository(IServiceProvider services)
{
var logger = services?.GetLogger<EphemeralXmlRepository>();
if (logger.IsWarningLevelEnabled())
{
logger.LogWarning("Using an in-memory repository. Keys will not be persisted to storage.");
}
}
示例2: KeyRingProvider
public KeyRingProvider(IKeyManager keyManager, KeyManagementOptions keyManagementOptions, IServiceProvider services)
{
_keyManagementOptions = new KeyManagementOptions(keyManagementOptions); // clone so new instance is immutable
_keyManager = keyManager;
_cacheableKeyRingProvider = services?.GetService<ICacheableKeyRingProvider>() ?? this;
_logger = services?.GetLogger<KeyRingProvider>();
_defaultKeyResolver = services?.GetService<IDefaultKeyResolver>()
?? new DefaultKeyResolver(_keyManagementOptions.KeyPropagationWindow, _keyManagementOptions.MaxServerClockSkew, services);
}
示例3: FileSystemXmlRepository
/// <summary>
/// Creates a <see cref="FileSystemXmlRepository"/> with keys stored at the given directory.
/// </summary>
/// <param name="directory">The directory in which to persist key material.</param>
/// <param name="services">An optional <see cref="IServiceProvider"/> to provide ancillary services.</param>
public FileSystemXmlRepository(DirectoryInfo directory, IServiceProvider services)
{
if (directory == null)
{
throw new ArgumentNullException(nameof(directory));
}
Directory = directory;
Services = services;
_logger = services?.GetLogger<FileSystemXmlRepository>();
}
示例4: RegistryXmlRepository
/// <summary>
/// Creates a <see cref="RegistryXmlRepository"/> with keys stored in the given registry key.
/// </summary>
/// <param name="registryKey">The registry key in which to persist key material.</param>
/// <param name="services">The <see cref="IServiceProvider"/> used to resolve services.</param>
public RegistryXmlRepository(RegistryKey registryKey, IServiceProvider services)
{
if (registryKey == null)
{
throw new ArgumentNullException(nameof(registryKey));
}
RegistryKey = registryKey;
Services = services;
_logger = services?.GetLogger<RegistryXmlRepository>();
}
示例5: EphemeralXmlRepository
public EphemeralXmlRepository(IServiceProvider services)
{
var logger = services?.GetLogger<EphemeralXmlRepository>();
logger?.UsingInmemoryRepository();
}
示例6: FileSystemXmlRepository
/// <summary>
/// Creates a <see cref="FileSystemXmlRepository"/> with keys stored at the given directory.
/// </summary>
/// <param name="directory">The directory in which to persist key material.</param>
/// <param name="services">An optional <see cref="IServiceProvider"/> to provide ancillary services.</param>
public FileSystemXmlRepository([NotNull] DirectoryInfo directory, IServiceProvider services)
{
Directory = directory;
Services = services;
_logger = services?.GetLogger<FileSystemXmlRepository>();
}
示例7: RegistryXmlRepository
/// <summary>
/// Creates a <see cref="RegistryXmlRepository"/> with keys stored in the given registry key.
/// </summary>
/// <param name="registryKey">The registry key in which to persist key material.</param>
public RegistryXmlRepository([NotNull] RegistryKey registryKey, IServiceProvider services)
{
RegistryKey = registryKey;
Services = services;
_logger = services?.GetLogger<RegistryXmlRepository>();
}