Пример #1
0
        internal void Write(NLog.LogEventInfo logEvent)
        {
            string logEventLoggerFullName = logEvent.LoggerName;

            //filtered events, and add to events only these events coming from experiment of this logViewModel, or from TraceLab application
            if (logEventLoggerFullName.StartsWith("TraceLab") || logEventLoggerFullName.StartsWith(ExperimentId))
            {
                string userFriendlySource;

                LogInfo info;
                if (logEventLoggerFullName.StartsWith("TraceLab"))
                {
                    userFriendlySource = logEventLoggerFullName;
                    info = new LogInfo {
                        SourceName = userFriendlySource, Source = logEventLoggerFullName, Level = logEvent.Level, Message = logEvent.FormattedMessage, Exception = logEvent.Exception
                    };
                }
                else
                {
                    string sourceAssembly, componentName;
                    TraceLab.Core.Components.LoggerFactory.ExtractLogSourceInfo(logEventLoggerFullName, out componentName, out sourceAssembly, out userFriendlySource);
                    info = new ComponentLogInfo
                    {
                        SourceName     = userFriendlySource,
                        Source         = logEventLoggerFullName,
                        Level          = logEvent.Level,
                        Message        = logEvent.FormattedMessage,
                        Exception      = logEvent.Exception,
                        ComponentName  = componentName,
                        AssemblySource = sourceAssembly
                    };

                    if (logEvent.Exception != null)
                    {
                        System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(logEvent.Exception);
                    }
                }

                m_events.Add(info);
            }
        }
Пример #2
0
        internal void Write(NLog.LogEventInfo logEvent)
        {
            string logEventLoggerFullName = logEvent.LoggerName;

            //filtered events, and add to events only these events coming from experiment of this logViewModel, or from TraceLab application
            if (logEventLoggerFullName.StartsWith("TraceLab") || logEventLoggerFullName.StartsWith(ExperimentId))
            {
                string userFriendlySource;

                LogInfo info;
                if (logEventLoggerFullName.StartsWith("TraceLab"))
                {
                    userFriendlySource = logEventLoggerFullName;
                    info = new LogInfo { SourceName = userFriendlySource, Source = logEventLoggerFullName, Level = logEvent.Level, Message = logEvent.FormattedMessage, Exception = logEvent.Exception };
                }
                else
                {
                    string sourceAssembly, componentName;
                    TraceLab.Core.Components.LoggerFactory.ExtractLogSourceInfo(logEventLoggerFullName, out componentName, out sourceAssembly, out userFriendlySource);
                    info = new ComponentLogInfo
                    {
                        SourceName = userFriendlySource,
                        Source = logEventLoggerFullName,
                        Level = logEvent.Level,
                        Message = logEvent.FormattedMessage,
                        Exception = logEvent.Exception,
                        ComponentName = componentName,
                        AssemblySource = sourceAssembly
                    };

                    if (logEvent.Exception != null)
                    {
                        System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(logEvent.Exception);
                    }
                }   
                
                m_events.Add(info);
            }
        }