Beispiel #1
0
            private void AssertUserMessageAtStartOfLogLine(
                LogEntry original, 
                LogEntry formmatted)
            {
                var startOfMessageEntry =
                    formmatted.Message.IndexOf(
                        original.Message,
                        StringComparison.Ordinal);

                Assert.Equal(0, startOfMessageEntry);
            }
        public void Log(LogEntry logEntry)
        {
            InitializeLoggerOnFirstCall();

            var formattedLogEntry = logEntry.IncludeExceptionInMessage();
            var message = formattedLogEntry.Message;
            var exception = formattedLogEntry.Exception;

            switch (logEntry.Severity)
            {
                case LoggingEventType.Error:
                    _logger.Error(exception, message);
                    break;
                case LoggingEventType.Fatal:
                    _logger.Fatal(exception, message);
                    break;
                default:
                    _logger.Info(exception, message);
                    break;
            }
        }
Beispiel #3
0
 private static LogEntry CreateSut(string message, Exception exception)
 {
     var sut = new LogEntry(LoggingEventType.Debug, message, exception);
     return sut;
 }