Esempio n. 1
0
        public SystemEvent Parse(IMessage message)
        {
            Verify.NotNull(message, "message");

            var process = processes.GetProcessById(message.ProcessId);

            return(new SystemEvent
            {
                Level = SystemEventLevel.Trace,
                ProcessName = process.Name,
                ProcessId = process.Id,
                Timestamp = message.Timestamp,
                Message = message.Message,
                Source = message.Source,
                RawMessage = new Lazy <String>(() => message.Message),
                Thread = String.Empty,
                Username = String.Empty,
            });
        }
Esempio n. 2
0
        public SystemEvent Parse(IMessage message)
        {
            Verify.NotNull(message, "message");

            var document = new XmlDocument();
            var process  = processes.GetProcessById(message.ProcessId);

            using (var reader = new XmlTextReader(message.Message ?? String.Empty, XmlNodeType.Element, xmlParserContext))
                document.Load(reader);

            return(new SystemEvent
            {
                Level = GetLevel(document),
                ProcessName = process.Name,
                ProcessId = process.Id,
                Timestamp = message.Timestamp,
                Thread = GetThread(document),
                Username = GetUsername(document),
                Source = GetSource(document),
                Message = GetMessage(document).Trim(),
                RawMessage = new Lazy <String>(() => FormatRawMessage(document)),
            });
        }
Esempio n. 3
0
        public SystemEvent Parse(IMessage message)
        {
            Verify.NotNull(message, "message");

            var match   = pattern.Match(message.Message);
            var process = processes.GetProcessById(message.ProcessId);
            var level   = Settings.GetLevel(match.Groups["level"].Value);

            return(match.Success
                       ? new SystemEvent
            {
                Level = level,
                ProcessName = process.Name,
                ProcessId = process.Id,
                Timestamp = message.Timestamp,
                Thread = match.Groups["thread"].Value,
                Source = match.Groups["logger"].Value,
                Message = match.Groups["message"].Value,
                Username = match.Groups["username"].Value,
                RawMessage = new Lazy <String>(() => message.Message)
            }
                       : SystemEvent.Create(message));
        }