[CLSCompliant(false)] // https://github.com/aspnet/Logging/issues/500
        public static ILoggerFactory AddLambdaLogger(this ILoggerFactory factory, LambdaLoggerOptions options)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            var provider = new LambdaILoggerProvider(options);

            factory.AddProvider(provider);
            return(factory);
        }
Example #2
0
        [CLSCompliant(false)] // https://github.com/aspnet/Logging/issues/500
        public static ILoggingBuilder AddLambdaLogger(this ILoggingBuilder builder, LambdaLoggerOptions options)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            var provider = new LambdaILoggerProvider(options);

            builder.AddProvider(provider);
            return(builder);
        }
        [CLSCompliant(false)] // https://github.com/aspnet/Logging/issues/500
        public static ILoggerFactory AddLambdaLogger(this ILoggerFactory factory, IConfiguration configuration, string loggingSectionName)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (string.IsNullOrEmpty(loggingSectionName))
            {
                throw new ArgumentNullException(nameof(loggingSectionName));
            }

            var options  = new LambdaLoggerOptions(configuration, loggingSectionName);
            var provider = new LambdaILoggerProvider(options);

            factory.AddProvider(provider);
            return(factory);
        }