internal TracerConfig(string cfg)
        {
            if (string.IsNullOrEmpty(cfg))
            {
                return;
            }

            var source = new TraceSource(TraceEnvVarName, SourceLevels.All);
            this.myListeners = source.Listeners;

            var parser = new TraceCfgParser(cfg);
            var newListener = parser.OutDevice;
            this.myFilters = parser.Filters;
            this.myNotFilters = parser.NotFilters;

            if (newListener != null)
            {
                // when the App.config _Trace source should be used we do not replace
                // anything
                if (!parser.UseAppConfigListeners)
                {
                    this.myListeners.Clear();
                    this.myListeners.Add(newListener);
                }
            }
            else
            {
                this.myListeners = null;
            }
        }
示例#2
0
        internal TracerConfig(string cfg)
        {
            if (string.IsNullOrEmpty(cfg))
            {
                return;
            }

            var source = new TraceSource(TraceEnvVarName, SourceLevels.All);

            this.myListeners = source.Listeners;

            var parser      = new TraceCfgParser(cfg);
            var newListener = parser.OutDevice;

            this.myFilters    = parser.Filters;
            this.myNotFilters = parser.NotFilters;

            if (newListener != null)
            {
                // when the App.config _Trace source should be used we do not replace
                // anything
                if (!parser.UseAppConfigListeners)
                {
                    this.myListeners.Clear();
                    this.myListeners.Add(newListener);
                }
            }
            else
            {
                this.myListeners = null;
            }
        }