Exemplo n.º 1
0
        private void MessageEventHandler(object sender, MUF.MessageContext e)
        {
            TestMessageLevel messageLevel;

            switch (e.Level)
            {
            case MUF.MessageLevel.Debug:
                messageLevel = TestMessageLevel.Error;
                break;

            case MUF.MessageLevel.Trace:
                messageLevel = TestMessageLevel.Error;
                break;

            case MUF.MessageLevel.Error:
                messageLevel = TestMessageLevel.Error;
                break;

            case MUF.MessageLevel.Warning:
                messageLevel = TestMessageLevel.Warning;
                break;

            case MUF.MessageLevel.Information:
                messageLevel = TestMessageLevel.Informational;
                break;

            default:
                messageLevel = default;
                break;
            }

            _vsLogger.SendMessage(messageLevel, e.Message);
        }
Exemplo n.º 2
0
        private static void Logger_MessageEvent(object sender, UTF.MessageContext e)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat(
                Engine.Resources.Strings.FormattedLogMessage,
                e.Timestamp.ToLongTimeString(),
                e.Level,
                e.Message)
            .AppendLine();

            byte[] bytes = UTF8Encoding.UTF8.GetBytes(stringBuilder.ToString());
            _fileStream.Write(bytes, 0, bytes.Length);
            _fileStream.Flush();
        }