Example #1
0
        private void CreateEventlogListener(EventlogListenerElement config)
        {
            IMonitoringChannel channel;

            if (config.Sampling.HasValue)
            {
                channel = this.factory.CreateChannel(config.Type, config.Target, config.Sampling.Value);
            }
            else
            {
                channel = this.factory.CreateChannel(config.Type, config.Target);
            }

            EventLogEntryType[] types = config.EntryTypes
                                        .Split(new [] { ';', ',' })
                                        .Where(s => !string.IsNullOrEmpty(s))
                                        .Select(s => (EventLogEntryType)Enum.Parse(typeof(EventLogEntryType), s.Trim()))
                                        .ToArray();

            var listener = new EventlogListener(
                config.Protocol,
                config.Source,
                config.Category,
                types,
                config.Key,
                config.Value,
                channel);

            this.listeners.Add(listener);
        }
Example #2
0
        private void CreateEventlogListener(EventlogListenerElement config)
        {
            IMonitoringChannel channel;

            if (config.Sampling.HasValue)
            {
                channel = this.factory.CreateChannel(config.Type, config.Target, config.Sampling.Value);
            }
            else
            {
                channel = this.factory.CreateChannel(config.Type, config.Target);
            }

            EventLogEntryType[] types = config.EntryTypes
                .Split(new []{ ';', ',' })
                .Where(s => !string.IsNullOrEmpty(s))
                .Select(s => (EventLogEntryType)Enum.Parse(typeof(EventLogEntryType), s.Trim()))
                .ToArray();

            var listener = new EventlogListener(
                config.Protocol,
                config.Source,
                config.Category,
                types,
                config.Key,
                config.Value,
                channel);

            this.listeners.Add(listener);
        }