Ejemplo n.º 1
0
 private static void TestLoggerFactoryListener(LogEventMessage eventMessage)
 {
     Assert.Equal(typeof(HttpClient).FullName, eventMessage.Category);
     Assert.Equal(3, eventMessage.EventInfo.Id);
     Assert.Equal("TestEvent", eventMessage.EventInfo.Name);
     Assert.Equal(2, eventMessage.MessageInfo.Count);
     Assert.Equal(20, eventMessage.MessageInfo["tag"]);
     Assert.Equal(40, eventMessage.MessageInfo["state"]);
     Assert.Equal("Message 20 for state 40", eventMessage.Message);
 }
Ejemplo n.º 2
0
 // This solution makes use of the Microsoft Enterprise Library 5.0 Logging Application Block.
 // Log4net or any other logger may be used instead, just update the app.config file, the references, and
 // substitue the new logging code here.  Please note: MS EL's Cryptography Application Block is also being used.
 protected void OnLogMessage(LogEventMessage e)
 {
     if (defaultWriter.IsLoggingEnabled())
     {
         LogEntry entry = new LogEntry();
         entry.EventId     = e.EventID;
         entry.Priority    = e.Priority;
         entry.Message     = e.Description;
         entry.ProcessName = e.Source;
         entry.Title       = e.Title;
         entry.TimeStamp   = DateTime.Now;
         if (e.Severity > System.Diagnostics.TraceEventType.Information)
         {
             entry.Categories.Add("Errors"); // Allows configuration of other trace listeners for special notifications.
         }
         defaultWriter.Write(entry);
     }
 }
Ejemplo n.º 3
0
 private void LogEventRaised(LogEventMessage message)
 {
     LogEventMessagesList.Add(message);
 }
Ejemplo n.º 4
0
 private static void LogWriterListener(LogEventMessage logEventMessage)
 {
     Console.WriteLine("kilroy");
     //Assert.Equal("3: Log event message", logEventMessage.EventInfo.ToString());
     //Assert.Equal("Hello World", logEventMessage.Message);
 }
Ejemplo n.º 5
0
 private static void LogWriterListener(LogEventMessage m)
 {
     Console.WriteLine($"Logging: {m.ErrorLevel}, {m.Category}, {m.Message}");
 }
Ejemplo n.º 6
0
 private static void InfoLogTestLogListener(LogEventMessage logEventMessage)
 {
     Assert.Equal("3: Log event message", logEventMessage.EventInfo.ToString());
     Assert.Equal("Hello World", logEventMessage.Message);
 }