コード例 #1
0
    private void OnEventsAdded(Playbook playbook, List <AbstractEvent> abstractEvents)
    {
        var events = abstractEvents.OfType <LogEvent>().ToList();

        if (events.Count == 0)
        {
            return;
        }

        foreach (var evt in events)
        {
            var text = evt.Text;
            if (evt.Arguments != null)
            {
                foreach (var arg in evt.Arguments)
                {
                    text = arg.Key.StartsWith("{spacing", StringComparison.OrdinalIgnoreCase)
                        ? text.Replace(arg.Key, "", StringComparison.InvariantCultureIgnoreCase)
                        : text.Replace(arg.Key, FormattingHelpers.ToDisplayValue(arg.Value), StringComparison.InvariantCultureIgnoreCase);
                }
            }

            var item = new LogModel()
            {
                Timestamp = new DateTime(evt.Timestamp),
                Playbook  = playbook,
                Event     = evt,
                Process   = evt.ProcessInvocationUID != null
                    ? playbook.DiagContext.WholePlaybook.ProcessList[evt.ProcessInvocationUID.Value]
                    : null,
                Text = text,
            };

            _updater.AddItem(item);
        }
    }
コード例 #2
0
 private void OnSinkStarted(Playbook playbook, TrackedSink sink)
 {
     _updater.AddItem(sink);
 }