A publisher for a specific event of a LogPublisher.
示例#1
0
        /// <summary>
        /// Initializes an <see cref="LogEventPublisher"/> with the provided values.
        /// </summary>
        /// <param name="level">the level of the message</param>
        /// <param name="flags">associated flags</param>
        /// <param name="eventName"></param>
        /// <param name="stackTraceDepth"></param>
        /// <param name="messagesPerSecond"></param>
        /// <param name="burstLimit"></param>
        /// <returns></returns>
        public LogEventPublisher RegisterEvent(MessageLevel level, MessageFlags flags, string eventName, int stackTraceDepth, MessageRate messagesPerSecond, int burstLimit)
        {
            LogMessageAttributes      flag      = new LogMessageAttributes(m_classification, level, MessageSuppression.None, flags);
            LogEventPublisherInternal publisher = InternalRegisterEvent(flag, eventName, stackTraceDepth, messagesPerSecond, burstLimit);

            return(new LogEventPublisher(this, publisher));
        }
示例#2
0
        /// <summary>
        /// Initializes an <see cref="LogEventPublisher"/> with the provided values.
        /// </summary>
        /// <param name="level">the level of the message</param>
        /// <param name="flags">associated flags</param>
        /// <param name="eventName">the name of the event.</param>
        /// <returns></returns>
        public LogEventPublisher RegisterEvent(MessageLevel level, MessageFlags flags, string eventName)
        {
            LogMessageAttributes      flag      = new LogMessageAttributes(m_classification, level, MessageSuppression.None, flags);
            LogEventPublisherInternal publisher = InternalRegisterEvent(flag, eventName);

            return(new LogEventPublisher(this, publisher));
        }
示例#3
0
        private LogEventPublisherInternal InternalRegisterNewEvent(LogMessageAttributes attributes, string eventName, int stackTraceDepth, double messagesPerSecond, int burstLimit)
        {
            //Note: A race condition can cause more then the maximum number of entries to exist, however, this is not a concern.
            if (m_lookupEventPublishers.Count > MaxDistinctEventPublisherCount)
            {
                if (m_excessivePublisherEventNames == null)
                {
                    var owner1 = new LogEventPublisherDetails(m_publisherInstance.TypeData,
                                                              "Excessive Event Names: Event names for this publisher has been limited to " + MaxDistinctEventPublisherCount.ToString() +
                                                              "Please adjust MaxDistinctEventPublisherCount if this is not a bug and this publisher can truly create this many publishers.");
                    m_excessivePublisherEventNames = new LogEventPublisherInternal(attributes, owner1, m_publisherInstance, m_logger, stackTraceDepth, messagesPerSecond, burstLimit);
                }
                return(m_excessivePublisherEventNames);
            }

            LogEventPublisherInternal publisher;
            var owner = new LogEventPublisherDetails(m_publisherInstance.TypeData, eventName);

            publisher = new LogEventPublisherInternal(attributes, owner, m_publisherInstance, m_logger, stackTraceDepth, messagesPerSecond, burstLimit);
            publisher = m_lookupEventPublishers.GetOrAdd(Tuple.Create(attributes, eventName), publisher);
            return(publisher);
        }
        private LogEventPublisherInternal InternalRegisterNewEvent(LogMessageAttributes attributes, string eventName, int stackTraceDepth, double messagesPerSecond, int burstLimit)
        {
            //Note: A race condition can cause more then the maximum number of entries to exist, however, this is not a concern.
            if (m_lookupEventPublishers.Count > MaxDistinctEventPublisherCount)
            {
                if (m_excessivePublisherEventNames == null)
                {
                    var owner1 = new LogEventPublisherDetails(m_publisherInstance.TypeData,
                        "Excessive Event Names: Event names for this publisher has been limited to " + MaxDistinctEventPublisherCount.ToString() +
                        "Please adjust MaxDistinctEventPublisherCount if this is not a bug and this publisher can truly create this many publishers.");
                    m_excessivePublisherEventNames = new LogEventPublisherInternal(attributes, owner1, m_publisherInstance, m_logger, stackTraceDepth, messagesPerSecond, burstLimit);
                }
                return m_excessivePublisherEventNames;
            }

            LogEventPublisherInternal publisher;
            var owner = new LogEventPublisherDetails(m_publisherInstance.TypeData, eventName);
            publisher = new LogEventPublisherInternal(attributes, owner, m_publisherInstance, m_logger, stackTraceDepth, messagesPerSecond, burstLimit);
            publisher = m_lookupEventPublishers.GetOrAdd(Tuple.Create(attributes, eventName), publisher);
            return publisher;
        }
示例#5
0
 internal LogEventPublisher(LogPublisher publisher, LogEventPublisherInternal internalPublisher)
 {
     m_publisher         = publisher;
     m_internalPublisher = internalPublisher;
 }
 internal LogEventPublisher(LogPublisher publisher, LogEventPublisherInternal internalPublisher)
 {
     m_publisher = publisher;
     m_internalPublisher = internalPublisher;
 }