Пример #1
0
        public TomatoLogClientRedisTest()
        {
            EventRedisOptions options = new EventRedisOptions
            {
                Channel          = "TomatoLogChannel",
                ConnectionString = "127.0.0.1:6379,defaultDatabase=10,password=123456",
                Logger           = null,
                LogLevel         = Microsoft.Extensions.Logging.LogLevel.Information,
                ProjectLabel     = "20272",
                ProjectName      = "TomatoLog-Server",
                SysOptions       = new EventSysOptions
                {
                    EventId     = true,
                    IP          = true,
                    IPList      = true,
                    MachineName = true,
                    ProcessId   = true,
                    ProcessName = true,
                    ThreadId    = true,
                    Timestamp   = true,
                    UserName    = true
                },
                Tags    = null,
                Version = "1.0.1"
            };

            client = new TomatoLogClientRedis(options);
        }
Пример #2
0
        public TomatoLogClientRedis(EventRedisOptions options) : base(options)
        {
            Check.NotNull(options.ConnectionString, nameof(options.ConnectionString));
            Check.NotNull(options.Channel, nameof(options.Channel));

            optionsRedis = options;
            multiplexer  = ConnectionMultiplexer.Connect(options.ConnectionString);
            Instance     = this;
        }
Пример #3
0
        public TomatoLogClientRedis(EventRedisOptions options) : base(options)
        {
            Check.NotNull(options.ConnectionString, nameof(options.ConnectionString));
            Check.NotNull(options.Channel, nameof(options.Channel));

            optionsRedis = options;
            RedisHelper.Initialization(new CSRedis.CSRedisClient(options.ConnectionString));
            Instance = this;
        }
        /// <summary>
        /// Use Redis with options
        /// </summary>
        /// <param name="optionAction"></param>
        /// <returns></returns>
        public TomatoLogSinkOptions UseRedis(Action <EventRedisOptions> optionAction = null)
        {
            if (optionAction != null)
            {
                var option = RedisOptions ?? new EventRedisOptions();
                optionAction(option);
                RedisOptions = option;
            }

            FlowType = LogFlowTypes.Redis;
            return(this);
        }