• CacheManager
  • Documentation
  • Api Docs
  • MichaCo.net
    Show / Hide Table of Contents

    Class MicrosoftLoggingBuilderExtensions

    Extensions for the configuration builder for logging.

    Usage

    Either configure a CacheManager specific logger factory:

    var builder = new Core.ConfigurationBuilder("myCache");
    builder.WithMicrosoftLogging(f =>
    {
        f.AddConsole(LogLevel.Information);
        f.AddDebug(LogLevel.Verbose);
    });
    

    Or pass in an existing ILoggerFactory:

    var builder = new Core.ConfigurationBuilder("myCache");
    builder.WithMicrosoftLogging(loggerFactory);
    
    Inheritance
    Object
    MicrosoftLoggingBuilderExtensions
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace:CacheManager.Core
    Assembly:CacheManager.Microsoft.Extensions.Logging.dll
    Syntax
    public static class MicrosoftLoggingBuilderExtensions
    Remarks

    To use the different log providers, install the corresponding Microsoft.Extensions.Logging.* package.

    Methods

    | Improve this Doc View Source

    WithMicrosoftLogging(ConfigurationBuilderCachePart, IServiceCollection)

    Configures cache manager logging to use a Microsoft.Extensions.Logging.ILoggerFactory which gets resolved from the serviceCollection.

    Declaration
    public static ConfigurationBuilderCachePart WithMicrosoftLogging(this ConfigurationBuilderCachePart part, IServiceCollection serviceCollection)
    Parameters
    Type Name Description
    ConfigurationBuilderCachePart part

    The builder part.

    Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection

    The services collection.

    Returns
    Type Description
    ConfigurationBuilderCachePart

    The builder.

    | Improve this Doc View Source

    WithMicrosoftLogging(ConfigurationBuilderCachePart, ILoggerFactory)

    Enables logging for the cache manager instance using an existion Microsoft.Extensions.Logging.ILoggerFactory as target.

    Declaration
    public static ConfigurationBuilderCachePart WithMicrosoftLogging(this ConfigurationBuilderCachePart part, ILoggerFactory loggerFactory)
    Parameters
    Type Name Description
    ConfigurationBuilderCachePart part

    The builder part.

    Microsoft.Extensions.Logging.ILoggerFactory loggerFactory

    The logger factory which should be used.

    Returns
    Type Description
    ConfigurationBuilderCachePart

    The builder.

    | Improve this Doc View Source

    WithMicrosoftLogging(ConfigurationBuilderCachePart, Action<ILoggerFactory>)

    Enables logging for the cache manager instance. Using this extension will create a NEW instance of Microsoft.Extensions.Logging.ILoggerFactory.

    If you use the standard Micorosft AspNetCore DI, you might want to use the other extensions which make CacheManager use the already injected/shared instance of Microsoft.Extensions.Logging.ILoggerFactory.

    Use the factory to configure the logger factory and add Microsoft.Extensions.Logging.ILoggerProviders as needed.

    Declaration
    public static ConfigurationBuilderCachePart WithMicrosoftLogging(this ConfigurationBuilderCachePart part, Action<ILoggerFactory> factory)
    Parameters
    Type Name Description
    ConfigurationBuilderCachePart part

    The builder part.

    Action<Microsoft.Extensions.Logging.ILoggerFactory> factory

    The logger factory used for configuring logging.

    Returns
    Type Description
    ConfigurationBuilderCachePart

    The builder.

    • Improve this Doc
    • View Source
    © 2025 by Michael Conrad. All rights reserved. - MichaCo.net