コード例 #1
0
        internal OpenTelemetryLoggerProvider AddProcessor(LogProcessor processor)
        {
            if (processor == null)
            {
                throw new ArgumentNullException(nameof(processor));
            }

            if (this.Processor == null)
            {
                this.Processor = processor;
            }
            else if (this.Processor is CompositeLogProcessor compositeProcessor)
            {
                compositeProcessor.AddProcessor(processor);
            }
            else
            {
                this.Processor = new CompositeLogProcessor(new[]
                {
                    this.Processor,
                    processor,
                });
            }

            return(this);
        }
コード例 #2
0
        /// <summary>
        /// Adds processor to the options.
        /// </summary>
        /// <param name="processor">Log processor to add.</param>
        /// <returns>Returns <see cref="OpenTelemetryLoggerOptions"/> for chaining.</returns>
        public OpenTelemetryLoggerOptions AddProcessor(LogProcessor processor)
        {
            if (processor == null)
            {
                throw new ArgumentNullException(nameof(processor));
            }

            this.Processors.Add(processor);

            return(this);
        }
コード例 #3
0
        public CompositeLogProcessor AddProcessor(LogProcessor processor)
        {
            if (processor == null)
            {
                throw new ArgumentNullException(nameof(processor));
            }

            var node = new DoublyLinkedListNode <LogProcessor>(processor)
            {
                Previous = this.tail,
            };

            this.tail.Next = node;
            this.tail      = node;

            return(this);
        }