protected IEnumerable<TraceEvent> LoadSampleTrace()
 {
     var traceSource = LoadEventSource();
       var parser = new IISLogTraceEventParser(traceSource);
       List<TraceEvent> events = new List<TraceEvent>();
       parser.All += e => {
     events.Add(e.Clone());
       };
       traceSource.Process();
       return events;
 }
        public void ObservesAllEvents()
        {
            var source = LoadEventSource();
              var parser = new IISLogTraceEventParser(source);
              var observable = parser.Observe(IISLogTraceEventParser.ProviderName, null);

              var counter = new CountingProcessor();
              var sourceProc = new TraceSourceProcessor(counter);

              sourceProc.Start(observable);
              source.Process();
              source.StopProcessing();
              sourceProc.Stop().Wait();

              Assert.AreEqual(9, counter.GetCount());
              Assert.IsTrue(counter.FlushCalled);
              Assert.IsTrue(counter.DisposeCalled);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            // create a new real-time ETW trace session
              using ( var session = new TraceEventSession(SessionName) ) {
            // enable IIS ETW provider and set up a new trace source on it
            session.EnableProvider(IISLogTraceEventParser.ProviderName, TraceEventLevel.Verbose);

            using ( var traceSource = new ETWTraceEventSource(SessionName, TraceEventSourceType.Session) ) {
              Console.WriteLine("Session started, listening for events...");
              var parser = new IISLogTraceEventParser(traceSource);
              parser.IISLog += OnIISRequest;

              traceSource.Process();
              Console.ReadLine();
              traceSource.StopProcessing();
            }
              }
        }
Exemplo n.º 4
0
 public void RegisterParser(TraceEventSource eventSource)
 {
     this.parser = new IISLogTraceEventParser(eventSource);
 }
 public void RegisterParser(TraceEventSource eventSource)
 {
     this.parser = new IISLogTraceEventParser(eventSource);
 }