Пример #1
0
        private void WriteMessage(Message message)
        {
            var messageText = GetMessageText(message);

            switch (message.Type)
            {
            case MessageType.Debug:
                Logger.Logger.Log(typeof(AsynchronousLogUtility), log4net.Core.Level.Debug, messageText, null);
                ConsoleWriter.ConsoleWrite(messageText, "DEBUG");
                break;

            case MessageType.Error:
                Logger.Logger.Log(typeof(AsynchronousLogUtility), log4net.Core.Level.Error, messageText, null);
                ConsoleWriter.ConsoleWrite(messageText, "ERROR");
                break;

            case MessageType.Fatal:
                Logger.Logger.Log(typeof(AsynchronousLogUtility), log4net.Core.Level.Fatal, messageText, null);
                ConsoleWriter.ConsoleWrite(messageText, "FATAL");
                break;

            case MessageType.Info:
                Logger.Logger.Log(typeof(AsynchronousLogUtility), log4net.Core.Level.Info, messageText, null);
                ConsoleWriter.ConsoleWrite(messageText, "INFO");
                break;

            case MessageType.Warning:
                Logger.Logger.Log(typeof(AsynchronousLogUtility), log4net.Core.Level.Warn, messageText, null);
                ConsoleWriter.ConsoleWrite(messageText, "WARN");
                break;

            default:
                break;
            }
        }