Ejemplo n.º 1
0
 private void UpdateStatus(LogMessageInfo info)
 {
     if (OnLog != null)
     {
         OnLog(info);
     }
 }
Ejemplo n.º 2
0
 private void DLaBOnLog(LogMessageInfo info)
 {
     _trace.WriteLine(info.ModalMessage);
     if (info.Detail != null && info.Detail != info.ModalMessage)
     {
         _trace.WriteLine(info.Detail);
     }
 }
        private static LogMessageInfo ConvertMessage(Loupe.Extensibility.Data.ILogMessage internalMessage)
        {
            if (internalMessage == null)
            {
                return(null);
            }

            LogMessageInfo message = new LogMessageInfo(internalMessage);

            return(message);
        }
Ejemplo n.º 4
0
        private static LogMessageInfo[] ConvertMessages(Loupe.Extensibility.Data.ILogMessage[] internalMessages)
        {
            if (internalMessages == null)
            {
                return(new LogMessageInfo[0]);
            }

            int count = internalMessages.Length;

            LogMessageInfo[] messages = new LogMessageInfo[count];

            for (int i = 0; i < count; i++)
            {
                messages[i] = new LogMessageInfo(internalMessages[i]);
            }

            return(messages);
        }
Ejemplo n.º 5
0
 private void UpdateStatus(LogMessageInfo info)
 {
     OnLog?.Invoke(info);
 }
 private void UpdateStatus(LogMessageInfo info)
 {
     if (OnLog != null)
     {
         OnLog(info);
     }
 }
        public TimelineLogCollectorActor()
        {
            Receive <LogMessage>(msg =>
            {
                var parsedInfo = new LogMessageInfo(msg);
                if (_timeline.ContainsKey(parsedInfo.When))
                {
                    _timeline[parsedInfo.When].Add(parsedInfo);
                }
                else
                {
                    _timeline.Add(parsedInfo.When, new HashSet <LogMessageInfo>()
                    {
                        parsedInfo
                    });
                }
            });

            Receive <SendMeAll>(_ => Sender.Tell(_timeline.Values.ToList()));

            Receive <GetSpecLog>(_ =>
            {
                var log = new SpecLog()
                {
                    AggregatedTimelineLog = _timeline.Select(pairs => pairs.Value).SelectMany(msg => msg).Select(m => m.ToString()).ToList(),
                    NodeLogs = _timeline.Select(pairs => pairs.Value).SelectMany(msg => msg).GroupBy(msg => msg.Node).Select(nodeMessages =>
                    {
                        var node = nodeMessages.Key;
                        return(NodeIndex: node.Index, NodeRole: node.Role, Logs: nodeMessages.Select(m => m.ToString()).ToList());
                    }).ToList()
                };

                Sender.Tell(log);
            });

            Receive <DumpToFile>(dump =>
            {
                // Verify that directory exists
                var dir = new DirectoryInfo(Path.GetDirectoryName(dump.FilePath));
                if (!dir.Exists)
                {
                    dir.Create();
                }

                File.AppendAllLines(dump.FilePath, _timeline.Select(pairs => pairs.Value).SelectMany(msg => msg).Select(m => m.ToString()));
                Sender.Tell(Done.Instance);
            });

            Receive <PrintToConsole>(_ =>
            {
                var logsPerTest = _timeline
                                  .Select(pairs => pairs.Value)
                                  .SelectMany(msg => msg)
                                  .GroupBy(m => m.Node.TestName);

                foreach (var testLogs in logsPerTest)
                {
                    Console.WriteLine($"Detailed logs for {testLogs.Key}\n");
                    foreach (var log in testLogs)
                    {
                        Console.WriteLine(log);
                    }
                    Console.WriteLine($"\nEnd logs for {testLogs.Key}\n");
                }

                Sender.Tell(Done.Instance);
            });
        }
Ejemplo n.º 8
0
 public TestLogEventMessage(string category, LogLevel logLevel, LogEventInfo eventInfo, string message, LogMessageInfo messageInfo, Exception exception = null)
     : base(category, logLevel, eventInfo, message, messageInfo, exception)
 {
 }
Ejemplo n.º 9
0
 public LogMessageControl(LogMessageInfo logMessage)
     : base(logMessage.Level.ToString(), logMessage.TimeStamp)
 {
     Message = logMessage.Message;
     Error   = logMessage.Error?.ToString();
 }