Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LogViewModel"/> class.
        /// </summary>
        private LogViewModel(string experimentId)
        {
            m_roEvents = new ReadOnlyObservableCollection <LogInfo>(m_events);

            var target = new OutputControlTarget(this);
            AsyncTargetWrapper asyncTargetWrapper = new AsyncTargetWrapper(target, 100, AsyncTargetWrapperOverflowAction.Grow);

            AddTargetToTraceLabRule(asyncTargetWrapper);

            if (NLog.LogManager.Configuration == null)
            {
                NLog.LogManager.Configuration = new NLog.Config.LoggingConfiguration();
            }

            if (experimentId != null)
            {
                ExperimentId = experimentId;
                NLog.LogManager.Configuration.AddTarget(ExperimentId, asyncTargetWrapper);
            }

            // Make sure the target we just added gets configured.
            NLog.LogManager.ReconfigExistingLoggers();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LogViewModel"/> class.
        /// </summary>
        private LogViewModel(string experimentId)
        {
            m_roEvents = new ReadOnlyObservableCollection<LogInfo>(m_events);
                        
            var target = new OutputControlTarget(this);
            AsyncTargetWrapper asyncTargetWrapper = new AsyncTargetWrapper(target, 100, AsyncTargetWrapperOverflowAction.Grow);
            AddTargetToTraceLabRule(asyncTargetWrapper);

            if (NLog.LogManager.Configuration == null)
            {
                NLog.LogManager.Configuration = new NLog.Config.LoggingConfiguration();
            }

            if (experimentId != null)
            {
                ExperimentId = experimentId;
                NLog.LogManager.Configuration.AddTarget(ExperimentId, asyncTargetWrapper);
            }

            // Make sure the target we just added gets configured.
            NLog.LogManager.ReconfigExistingLoggers();
        }