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

        var provider = new BunyanLambdaILoggerProvider(options);

        factory.AddProvider(provider);
        return(factory);
    }
Exemple #2
0
    [CLSCompliant(false)] // https://github.com/aspnet/Logging/issues/500
    public static ILoggerFactory AddBunyanLambdaLogger(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 BunyanLambdaILoggerProvider(options);

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