private void NoConfigInit()
 {
     internalSwitch = new SourceSwitch(sourceName, switchLevel.ToString());
     listeners      = new TraceListenerCollection();
     listeners.Add(new DefaultTraceListener());
     attributes = null;
 }
Exemple #2
0
        private void Initialize()
        {
            if (!_initCalled)
            {
                lock (this)
                {
                    if (_initCalled)
                    {
                        return;
                    }

                    if (_configInitializing)
                    {
                        return;
                    }

                    _configInitializing = true;

                    NoConfigInit_BeforeEvent();

                    InitializingTraceSourceEventArgs e = new InitializingTraceSourceEventArgs(this);
                    OnInitializing(e);

                    if (!e.WasInitialized)
                    {
                        NoConfigInit_AfterEvent();
                    }

                    _configInitializing = false;
                    _initCalled         = true;
                }
            }

            void NoConfigInit_BeforeEvent()
            {
                _listeners      = new TraceListenerCollection();
                _internalSwitch = new SourceSwitch(_sourceName, _switchLevel.ToString());
            }

            void NoConfigInit_AfterEvent()
            {
                Debug.Assert(_listeners != null);
                _listeners.Add(new DefaultTraceListener());
            }
        }
Exemple #3
0
 private void NoConfigInit()
 {
     _internalSwitch = new SourceSwitch(_sourceName, _switchLevel.ToString());
     _listeners      = new TraceListenerCollection();
     _listeners.Add(new DefaultTraceListener());
 }