Esempio n. 1
0
 public void TestWriteSummaryRequestLogsSuccess()
 {
     VerifyLog(TraceUtilities.SUMMARY_REQUEST_LOGS_SOURCE, delegate()
     {
         // Ensure success summaries are logged at the info level.
         TraceUtilities.WriteSummaryRequestLogs(TEST_LOG_MESSAGE, false);
     }, INFO_MARKER);
 }
Esempio n. 2
0
 public void TestWriteSummaryRequestLogsFailure()
 {
     VerifyLog(TraceUtilities.SUMMARY_REQUEST_LOGS_SOURCE, delegate()
     {
         // Ensure failure summaries are logged at the warning level.
         TraceUtilities.WriteSummaryRequestLogs(TEST_LOG_MESSAGE, true);
     }, WARNING_MARKER);
 }
Esempio n. 3
0
        public void TestWriteSummaryRequestLogsSuccess()
        {
            using (var stream = new MemoryStream()) {
                enableLoggingToMemoryStream(TraceUtilities.SUMMARY_REQUEST_LOGS_SOURCE, stream);

                // Ensure success summaries are logged at the info level.
                TraceUtilities.WriteSummaryRequestLogs(TEST_LOG_MESSAGE, false);
                StringAssert.Contains(INFO_MARKER, getLogFromMemoryStream(stream));
            }
        }
Esempio n. 4
0
        public void TestWriteSummaryRequestLogsFailure()
        {
            using (var stream = new MemoryStream()) {
                enableLoggingToMemoryStream(TraceUtilities.SUMMARY_REQUEST_LOGS_SOURCE, stream);

                // Ensure failure summaries are logged at the warning level.
                TraceUtilities.WriteSummaryRequestLogs(TEST_LOG_MESSAGE, true);
                StringAssert.Contains(WARNING_MARKER, getLogFromMemoryStream(stream));
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Verifies that the text logged by <paramref name="loggingAction"/> contains
        /// <paramref name="markerToVerify"/> text.
        /// </summary>
        /// <param name="logSource">The log source.</param>
        /// <param name="loggingAction">The logging action.</param>
        /// <param name="markerToVerify">The marker to verify.</param>
        private void VerifyLog(string logSource, Action loggingAction, string markerToVerify)
        {
            using (var stream = new MemoryStream())
            {
                TraceUtilities.Configure(logSource, new StreamWriter(stream), SourceLevels.All);

                loggingAction();
                // Ensure failure summaries are logged at the warning level.
                TraceUtilities.WriteSummaryRequestLogs(TEST_LOG_MESSAGE, true);

                string logFromMemStream = Encoding.UTF8.GetString(stream.ToArray());
                StringAssert.Contains(markerToVerify, logFromMemStream);
            }
        }
 void ITraceWriter.WriteSummaryRequestLogs(string message, bool isFailure)
 {
     TraceUtilities.WriteSummaryRequestLogs(message, isFailure);
 }
Esempio n. 7
0
 /// <summary>
 /// Writes the HTTP logs.
 /// </summary>
 public void Flush()
 {
     TraceUtilities.WriteDetailedRequestLogs(this.DetailedLog, isFailure);
     TraceUtilities.WriteSummaryRequestLogs(this.SummaryLog, isFailure);
 }
Esempio n. 8
0
 /// <summary>
 /// Writes summary logs.
 /// </summary>
 /// <param name="logEntry">The log entry.</param>
 void ITraceWriter.WriteSummaryRequestLogs(LogEntry logEntry)
 {
     TraceUtilities.WriteSummaryRequestLogs(logEntry.SummaryLog, logEntry.IsFailure);
 }