Ejemplo n.º 1
0
        public ElkRedisLogger(IConnectionMultiplexer connection, ElkRedisOption option, string logger_name)
        {
            connection.Should().NotBeNull();
            option.Should().NotBeNull();
            logger_name.Should().NotBeNullOrEmpty();

            this._connection  = connection;
            this._option      = option;
            this._logger_name = logger_name;
        }
Ejemplo n.º 2
0
        public static ILoggingBuilder AddElkRedisPipline(this ILoggingBuilder builder,
                                                         IConnectionMultiplexer con,
                                                         Func <ElkRedisOption, ElkRedisOption> config = null)
        {
            con.Should().NotBeNull("elk pipline:redis connection");
            config.Should().NotBeNull("elk pipline:config");

            var option = new ElkRedisOption();

            if (config != null)
            {
                option = config.Invoke(option);
            }

            option.Valid();

            builder.AddProvider(provider: new ElkRedisProvider(connection: con, option: option));
            return(builder);
        }
Ejemplo n.º 3
0
        public static ILoggerFactory AddElkRedis(this ILoggerFactory factory,
                                                 IConnectionMultiplexer con,
                                                 Func <ElkRedisOption, ElkRedisOption> config)
        {
            con.Should().NotBeNull("elk pipline:redis connection");
            config.Should().NotBeNull("elk pipline:config");

            var option = new ElkRedisOption();

            if (config != null)
            {
                option = config.Invoke(option);
            }

            option.Valid();

            factory.AddProvider(provider: new ElkRedisProvider(connection: con, option: option));
            return(factory);
        }
Ejemplo n.º 4
0
 public ElkRedisProvider(IConnectionMultiplexer connection, ElkRedisOption option)
 {
     this._con           = connection;
     this._logger_getter = key => new ElkRedisLogger(this._con, option, key);
 }