Пример #1
0
 public static void LogMessage(this ITask task,string message, params object[] messageArgs)
 {
     var buildEngine = task.BuildEngine;
     
     BuildMessageEventArgs e = new BuildMessageEventArgs(string.Format(message, messageArgs), (string)null, task.GetType().Name, MessageImportance.Normal);
     buildEngine.LogMessageEvent(e);
 }
Пример #2
0
        protected override void WriteInternal(WriteStyle style, string value)
        {
            // TODO: How do we normalize this with the current design? Perhaps hold lines without a line end until we get one?

            // MSBuild ALWAYS is a "Writeline"
            value = value.Trim('\f', '\n', '\r');
            if (string.IsNullOrWhiteSpace(value)) { return; }

            if (style.HasFlag(WriteStyle.Error))
            {
                LogError(value);
            }
            else if (style.HasFlag(WriteStyle.Critical))
            {
                LogWarning(value);
            }
            else
            {
                MessageImportance importance = MessageImportance.Normal;
                if (style.HasFlag(WriteStyle.Bold) || style.HasFlag(WriteStyle.Important))
                {
                    importance = MessageImportance.High;
                }

                BuildMessageEventArgs message = new BuildMessageEventArgs(
                    message: value,
                    helpKeyword: null,
                    senderName: _taskName,
                    importance: importance);

                _buildEngine.LogMessageEvent(message);
            }
        }
        public void LogBuildEvents()
        {
            // This event should only be logged when OnlyLogCriticalEvents is off
            BuildMessageEventArgs messageEvent = new BuildMessageEventArgs("MyMessage", "HelpKeyword", "Sender", MessageImportance.High);

            // These three should be logged when OnlyLogCritical Events is on or off
            BuildWarningEventArgs warning = new BuildWarningEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender");
            BuildErrorEventArgs error = new BuildErrorEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender");
            ExternalProjectStartedEventArgs externalStartedEvent = new ExternalProjectStartedEventArgs("message", "help", "senderName", "projectFile", "targetNames");

            ProcessBuildEventHelper loggingService = (ProcessBuildEventHelper)ProcessBuildEventHelper.CreateLoggingService(LoggerMode.Synchronous, 1);

            // Verify when OnlyLogCriticalEvents is false
            LogandVerifyBuildEvent(messageEvent, loggingService);
            LogandVerifyBuildEvent(warning, loggingService);
            LogandVerifyBuildEvent(error, loggingService);
            LogandVerifyBuildEvent(externalStartedEvent, loggingService);

            // Verify when OnlyLogCriticalEvents is true
            loggingService.OnlyLogCriticalEvents = true;
            loggingService.LogBuildEvent(messageEvent);
            Assert.IsNull(loggingService.ProcessedBuildEvent, "Expected ProcessedBuildEvent to be null");
            LogandVerifyBuildEvent(warning, loggingService);
            LogandVerifyBuildEvent(error, loggingService);
            LogandVerifyBuildEvent(externalStartedEvent, loggingService);
        }
Пример #4
0
        /// <summary>
        /// Raises a message event to all registered loggers.
        /// </summary>
        /// <owner>SumedhK</owner>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        internal void RaiseMessageEvent(object sender, BuildMessageEventArgs e)
        {
            if (MessageRaised != null)
            {
                try
                {
                    MessageRaised(sender, e);
                }
                catch (LoggerException)
                {
                    // if a logger has failed politely, abort immediately
                    // first unregister all loggers, since other loggers may receive remaining events in unexpected orderings
                    // if a fellow logger is throwing in an event handler.
                    this.UnregisterAllLoggers();
                    throw;
                }
                catch (Exception exception)
                {
                    // first unregister all loggers, since other loggers may receive remaining events in unexpected orderings
                    // if a fellow logger is throwing in an event handler.
                    this.UnregisterAllLoggers();
                    InternalLoggerException.Throw(exception, e, "FatalErrorWhileLogging", false);
                }
            }

            RaiseAnyEvent(sender, e);
        }
Пример #5
0
		public void LogMessageEvent(BuildMessageEventArgs e)
		{
			if (MessageIsImportantEnough(e.Importance))
			{
				Console.WriteLine(e.Message);
			}
		}
Пример #6
0
        /// <summary>
        /// Logs a message event for the current task
        /// Thread safe.
        /// </summary>
        /// <param name="e">The event args</param>
        public void LogMessageEvent(Microsoft.Build.Framework.BuildMessageEventArgs e)
        {
            lock (_callbackMonitor)
            {
                ErrorUtilities.VerifyThrowArgumentNull(e, "e");

                if (!_activeProxy)
                {
                    // The task has been logging on another thread, typically
                    // because of logging a spawned process's output, and has
                    // not terminated this logging before it returned. This is common
                    // enough that we don't want to crash and break the entire build. But
                    // we don't have any good way to log it any more, as not only has this task
                    // finished, the whole build might have finished! The task author will
                    // just have to figure out that their task has a bug by themselves.
                    if (s_breakOnLogAfterTaskReturns)
                    {
                        Trace.Fail(String.Format(CultureInfo.CurrentUICulture, "Task at {0}, after already returning, attempted to log '{1}'", _taskLocation.ToString(), e.Message));
                    }

                    return;
                }

                // If we are in building across process we need the events to be serializable. This method will
                // check to see if we are building with multiple process and if the event is serializable. It will
                // also log a warning if the event is not serializable and drop the logging message.
                if (IsRunningMultipleNodes && !IsEventSerializable(e))
                {
                    return;
                }

                e.BuildEventContext = _taskLoggingContext.BuildEventContext;
                _taskLoggingContext.LoggingService.LogBuildEvent(e);
            }
        }
Пример #7
0
        public void VerifyEventType()
        {
            BuildFinishedEventArgs buildFinished = new BuildFinishedEventArgs("Message", "Keyword", true);
            BuildStartedEventArgs buildStarted = new BuildStartedEventArgs("Message", "Help");
            BuildMessageEventArgs lowMessage = new BuildMessageEventArgs("Message", "help", "sender", MessageImportance.Low);
            TaskStartedEventArgs taskStarted = new TaskStartedEventArgs("message", "help", "projectFile", "taskFile", "taskName");
            TaskFinishedEventArgs taskFinished = new TaskFinishedEventArgs("message", "help", "projectFile", "taskFile", "taskName", true);
            TaskCommandLineEventArgs commandLine = new TaskCommandLineEventArgs("commandLine", "taskName", MessageImportance.Low);
            BuildWarningEventArgs warning = new BuildWarningEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender");
            BuildErrorEventArgs error = new BuildErrorEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender");
            TargetStartedEventArgs targetStarted = new TargetStartedEventArgs("message", "help", "targetName", "ProjectFile", "targetFile");
            TargetFinishedEventArgs targetFinished = new TargetFinishedEventArgs("message", "help", "targetName", "ProjectFile", "targetFile", true);
            ProjectStartedEventArgs projectStarted = new ProjectStartedEventArgs(-1, "message", "help", "ProjectFile", "targetNames", null, null, null);
            ProjectFinishedEventArgs projectFinished = new ProjectFinishedEventArgs("message", "help", "ProjectFile", true);
            ExternalProjectStartedEventArgs externalStartedEvent = new ExternalProjectStartedEventArgs("message", "help", "senderName", "projectFile", "targetNames");

            VerifyLoggingPacket(buildFinished, LoggingEventType.BuildFinishedEvent);
            VerifyLoggingPacket(buildStarted, LoggingEventType.BuildStartedEvent);
            VerifyLoggingPacket(lowMessage, LoggingEventType.BuildMessageEvent);
            VerifyLoggingPacket(taskStarted, LoggingEventType.TaskStartedEvent);
            VerifyLoggingPacket(taskFinished, LoggingEventType.TaskFinishedEvent);
            VerifyLoggingPacket(commandLine, LoggingEventType.TaskCommandLineEvent);
            VerifyLoggingPacket(warning, LoggingEventType.BuildWarningEvent);
            VerifyLoggingPacket(error, LoggingEventType.BuildErrorEvent);
            VerifyLoggingPacket(targetStarted, LoggingEventType.TargetStartedEvent);
            VerifyLoggingPacket(targetFinished, LoggingEventType.TargetFinishedEvent);
            VerifyLoggingPacket(projectStarted, LoggingEventType.ProjectStartedEvent);
            VerifyLoggingPacket(projectFinished, LoggingEventType.ProjectFinishedEvent);
            VerifyLoggingPacket(externalStartedEvent, LoggingEventType.CustomEvent);
        }
Пример #8
0
 private void eventSource_MessageRaised(object sender, Microsoft.Build.Framework.BuildMessageEventArgs e)
 {
     if ((needToLog) && (e.Importance <= MessageImportance.Normal))
     {
         this.AddNode(String.Format("      {0}", e.Message));
     }
 }
 public bool Execute()
 {
     StreamReader streamreaderAssemblyInfo = null;
     Match matchVersion;
     Group groupVersion;
     string strLine;
     strAssemblyFileVersion = String.Empty;
     try
     {
         streamreaderAssemblyInfo = new StreamReader(strFilePathAssemblyInfo);
         while ((strLine = streamreaderAssemblyInfo.ReadLine()) != null)
         {
             matchVersion = Regex.Match(strLine, @"(?:AssemblyFileVersion\("")(?<ver>(\d*)\.(\d*)(\.(\d*)(\.(\d*))?)?)(?:""\))", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | RegexOptions.ExplicitCapture);
             if (matchVersion.Success)
             {
                 groupVersion = matchVersion.Groups["ver"];
                 if ((groupVersion.Success) && (!String.IsNullOrEmpty(groupVersion.Value)))
                 {
                     strAssemblyFileVersion = groupVersion.Value;
                     break;
                 }
             }
         }
     }
     catch (Exception e)
     {
         BuildMessageEventArgs args = new BuildMessageEventArgs(e.Message, string.Empty, "GetAssemblyFileVersion", MessageImportance.High);
         BuildEngine.LogMessageEvent(args);
     }
     finally { if (streamreaderAssemblyInfo != null) streamreaderAssemblyInfo.Close(); }
     return (true);
 }
Пример #10
0
        /// <summary>
        /// Handler for a BuildMessage log event. Adds the node to the appropriate target.
        /// </summary>
        /// <param name="buildMessageEventArgs">The <see cref="BuildMessageEventArgs"/> instance containing the event data.</param>
        /// <param name="messagePrefix">The message prefix.</param>
        public void AddTaskParameter(BuildMessageEventArgs buildMessageEventArgs, string messagePrefix)
        {
            var project = GetOrAddProject(buildMessageEventArgs.BuildEventContext.ProjectContextId);
            var target = project.GetTargetById(buildMessageEventArgs.BuildEventContext.TargetId);
            var task = target.GetTaskById(buildMessageEventArgs.BuildEventContext.TaskId);

            task.AddParameter(TaskParameter.Create(buildMessageEventArgs.Message, messagePrefix));
        }
        public void eventSource_MessageRaised(object sender, BuildMessageEventArgs e)
        {
            if((e.Importance == MessageImportance.High && IsVerbosityAtLeast(LoggerVerbosity.Minimal)) ||
               (e.Importance == MessageImportance.Normal && IsVerbosityAtLeast(LoggerVerbosity.Normal)) ||
			   (e.Importance == MessageImportance.Low && IsVerbosityAtLeast(LoggerVerbosity.Detailed)))
            {
                WriteMessage(e.Message);
            }
        }
Пример #12
0
        void eventSource_MessageRaised(object sender, BuildMessageEventArgs e)
        {
            if (e.GetType() == typeof(TaskCommandLineEventArgs))
            {
                TaskCommandLineEventArgs cl = (TaskCommandLineEventArgs)e;

                MFuVisionGenerator.EnqueueItem(cl.Message, Directory.GetCurrentDirectory(), this.ProjectBuildContext);
            }
        }
 public void TestLogMessageLogsABuildErrorWhenATsLintWarningOccurs()
 {
     mockBuildEngine.Setup(engine => engine.LogErrorEvent(It.IsAny<BuildErrorEventArgs>()));
     mockBuildEngine.Setup(engine => engine.LogMessageEvent(It.IsAny<BuildMessageEventArgs>()));
     BuildMessageEventArgs message = new BuildMessageEventArgs(
         @"(quotemark) Private\Welcome\Welcome.ts[4, 20]: ' should be """,
         string.Empty,
         string.Empty,
         MessageImportance.High);
     TsLintLogAnalyzer.LogMessage(mockBuildEngine.Object, message);
 }
 /// <summary>
 /// Perform Cancel Code
 /// </summary>
 public void Cancel()
 {
     try
     {
         proc.Kill();
     }
     catch (Exception ex)
     {
         BuildMessageEventArgs taskEvent2 = new BuildMessageEventArgs(ex.Message, "", "", MessageImportance.High);
         BuildEngine.LogMessageEvent(taskEvent2);
     }
 }
 void eventSource_MessageRaised(object sender, BuildMessageEventArgs e)
 {
     // BuildMessageEventArgs adds Importance to BuildEventArgs
     // Let's take account of the verbosity setting we've been passed in deciding whether to log the message
     if ((e.Importance == MessageImportance.High && IsVerbosityAtLeast(LoggerVerbosity.Minimal))
         || (e.Importance == MessageImportance.Normal && IsVerbosityAtLeast(LoggerVerbosity.Normal))
         || (e.Importance == MessageImportance.Low && IsVerbosityAtLeast(LoggerVerbosity.Detailed))
         )
     {
         WriteLineWithSenderAndMessage(String.Empty, e);
     }
 }
Пример #16
0
 private void EventSourceMessageRaised(object sender, BuildMessageEventArgs e)
 {
     // BuildMessageEventArgs adds Importance to BuildEventArgs
     // Let's take account of the verbosity setting we've been passed in deciding whether to log the message
     if ((e.Importance == MessageImportance.High && _verbosity == LoggerVerbosity.Minimal)
         || (e.Importance == MessageImportance.Normal && _verbosity == LoggerVerbosity.Normal)
         || (e.Importance == MessageImportance.Low && _verbosity == LoggerVerbosity.Detailed)
         )
     {
         WriteMessage(string.Empty, e);
     }
 }
		public void AssignmentTest ()
		{
			BuildMessageEventArgs bmea;
			string message = "message";
			string helpKeyword = "helpKeyword";
			string senderName = "senderName";
			MessageImportance messageImportance = MessageImportance.High;
			
			bmea = new BuildMessageEventArgs (message, helpKeyword, senderName, messageImportance);
			
			Assert.AreEqual (message, bmea.Message, "Message");
			Assert.AreEqual (helpKeyword, bmea.HelpKeyword, "HelpKeyword");
			Assert.AreEqual (senderName, bmea.SenderName, "SenderName");
			Assert.AreEqual (messageImportance, bmea.Importance, "Importance");
		}
 public void EventArgsCtors()
 {
     BuildMessageEventArgs bmea = new BuildMessageEventArgs2();
     bmea = new BuildMessageEventArgs("Message", "HelpKeyword", "Sender", MessageImportance.Low);
     bmea = new BuildMessageEventArgs("Message", "HelpKeyword", "Sender", MessageImportance.Low, DateTime.Now);
     bmea = new BuildMessageEventArgs("{0}", "HelpKeyword", "Sender", MessageImportance.Low, DateTime.Now, "Message");
     bmea = new BuildMessageEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "Sender", MessageImportance.Low);
     bmea = new BuildMessageEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "Sender", MessageImportance.Low, DateTime.Now);
     bmea = new BuildMessageEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "Sender", MessageImportance.Low, DateTime.Now, "Message");
     bmea = new BuildMessageEventArgs(null, null, null, MessageImportance.Low);
     bmea = new BuildMessageEventArgs(null, null, null, MessageImportance.Low, DateTime.Now);
     bmea = new BuildMessageEventArgs(null, null, null, MessageImportance.Low, DateTime.Now, null);
     bmea = new BuildMessageEventArgs(null, null, null, 0, 0, 0, 0, null, null, null, MessageImportance.Low);
     bmea = new BuildMessageEventArgs(null, null, null, 0, 0, 0, 0, null, null, null, MessageImportance.Low, DateTime.Now);
     bmea = new BuildMessageEventArgs(null, null, null, 0, 0, 0, 0, null, null, null, MessageImportance.Low, DateTime.Now, null);
 }
        /// <summary>
        /// Logs a message event for the current task
        /// </summary>
        /// <param name="e">The event args</param>
        public void LogMessageEvent(Microsoft.Build.Framework.BuildMessageEventArgs e)
        {
            ErrorUtilities.VerifyThrowArgumentNull(e, "e");
            VerifyActiveProxy();

            // If we are in building across process we need the events to be serializable. This method will
            // check to see if we are building with multiple process and if the event is serializable. It will
            // also log a warning if the event is not serializable and drop the logging message.
            if (IsRunningMultipleNodes && !IsEventSerializable(e))
            {
                return;
            }

            e.BuildEventContext = _loggingContext.BuildEventContext;
            _loggingContext.LoggingService.LogBuildEvent(e);
        }
        public void TestConsumeMessageBuildEvent()
        {
            bool wentInHandler = false;
            BuildMessageEventArgs messageEvent = new BuildMessageEventArgs("My message", "Help me keyword", "Sender", MessageImportance.High);
            SendDataDelegate transportDelegate = delegate (INodePacket packet)
                                                 {
                                                     wentInHandler = true;
                                                     LogMessagePacket loggingPacket = packet as LogMessagePacket;
                                                     Assert.NotNull(loggingPacket);
                                                     BuildMessageEventArgs messageEventFromPacket = loggingPacket.NodeBuildEvent.Value.Value as BuildMessageEventArgs;
                                                     Assert.Equal(messageEventFromPacket, messageEvent);
                                                 };

            BuildEventArgTransportSink transportSink = new BuildEventArgTransportSink(transportDelegate);
            transportSink.Consume(messageEvent, 0);
            Assert.True(wentInHandler); // "Expected to go into transport delegate"
        }
Пример #21
0
		void eventSource_MessageRaised(object sender, BuildMessageEventArgs e)
		{
			if (_output == null || e.Importance == MessageImportance.Low || String.IsNullOrEmpty(e.Message))
				return;

			_output.WriteStartElement("message");
			try
			{
				_output.WriteAttributeString("level", e.Importance.ToString().ToLower());
				_output.WriteAttributeString("text", e.Message.Trim());
			}
			finally
			{
				_output.WriteEndElement();
				_output.Flush();
			}
		}
        public static bool LogMessage(IBuildEngine buildEngine, BuildMessageEventArgs args)
        {
            bool success = true;
            if (args.Importance == MessageImportance.High)
            {
                int index = 0;
                using (TextReader reader = new StringReader(args.Message))
                {
                    for (string line = reader.ReadLine(); line != null; line = reader.ReadLine())
                    {
                        Match match = tsLintRegex.Match(line);
                        if (match.Success)
                        {
                            int lineNumber = int.Parse(match.Groups["LineNumber"].Value);
                            int columnNumber = int.Parse(match.Groups["ColumnNumber"].Value);
                            BuildErrorEventArgs errorArgs = new BuildErrorEventArgs(
                                string.Empty,
                                string.Empty,
                                match.Groups["FileName"].Value,
                                lineNumber,
                                columnNumber,
                                0,
                                0,
                                match.Groups["End"].Value,
                                string.Empty,
                                string.Empty);
                            buildEngine.LogErrorEvent(errorArgs);
                            success = false;
                            index++;
                            if (index == 100)
                            {
                                break;
                            }
                        }
                    }
                }
            }

            buildEngine.LogMessageEvent(args);
            return success;
        }
Пример #23
0
        public override bool Execute()
        {
            try
            {

                TFVC _tfs = new TFVC();
                bool _changesetsFound = false;
                foreach (string _vcPath in _tfs.GetWorkspaceWorkingFolderServerMappings(_ws, _owner))
                {
                    BuildMessageEventArgs _bmsg = new BuildMessageEventArgs("Checking: " + _vcPath, "help", null, MessageImportance.Low);
                    BuildEngine.LogMessageEvent(_bmsg);
                    if (_tfs.Check4ChangeSetsSinceLabel(_lastGoodBuild, _vcPath))
                    {
                        BuildEngine.LogMessageEvent(new BuildMessageEventArgs("Changesets founds[" + _tfs.ChangesetsFoundCount + "]: " + _tfs.ChangesetsFound, "help", null, MessageImportance.Low));
                        _changesetsFound = true;
                        break;
                    }
                }

                if (_changesetsFound)
                {
                    return true;
                }
                else
                {
                    BuildErrorEventArgs _berror = new BuildErrorEventArgs("No Changes since last good build", "HIC:4201", null, 0, 0, 0, 0, "No changessets were found since the " + _lastGoodBuild, null, null);
                    BuildEngine.LogErrorEvent(_berror);
                    return false;
                }

            }
            catch (Exception _ex)
            {
                BuildErrorEventArgs _berr = new BuildErrorEventArgs(_ex.Message, _ex.StackTrace, _ex.Source, 0, 0, 0, 0, _ex.Message, _ex.HelpLink, null);
                BuildEngine.LogErrorEvent(_berr);
                return false;
            }
        }
        public void TestForwardingNotNullEvent()
        {
            EventSourceSink testSink = new EventSourceSink();
            EventRedirectorToSink eventRedirector = new EventRedirectorToSink(5, testSink);
            BuildMessageEventArgs messageEvent = new BuildMessageEventArgs("My message", "Help me keyword", "Sender", MessageImportance.High);
            bool wentInHandler = false;
            testSink.AnyEventRaised += new AnyEventHandler
                (
                  delegate
                  (
                    object sender,
                    BuildEventArgs buildEvent
                  )
                  {
                      wentInHandler = true;
                      BuildMessageEventArgs messageEventFromPacket = buildEvent as BuildMessageEventArgs;
                      Assert.IsTrue(messageEvent == messageEventFromPacket, "Expected messageEvent to be forwarded to match actually forwarded event");
                  }

                );

            ((IEventRedirector)eventRedirector).ForwardEvent(messageEvent);
            Assert.IsTrue(wentInHandler, "Expected to go into event handler");
        }
Пример #25
0
		private void eventSource_MessageHandler(object sender, BuildMessageEventArgs e)
		{
            LogMessage(XmlLoggerElements.Message, e.Message, e.Importance, e.Timestamp);
        }
Пример #26
0
		void LogMessage (MessageImportance importance, string message, params object [] messageArgs)
		{
			if (message == null)
				throw new ArgumentNullException ("message");

			BuildMessageEventArgs bmea = new BuildMessageEventArgs (
				String.Format (message, messageArgs), null,
				null, importance);
			engine.EventSource.FireMessageRaised (this, bmea);
		}
Пример #27
0
		void LogTargetSkipped ()
		{
			BuildMessageEventArgs bmea;
			bmea = new BuildMessageEventArgs (String.Format (
						"Target {0} skipped, as it has already been built.", Name),
					null, null, MessageImportance.Low);

			project.ParentEngine.EventSource.FireMessageRaised (this, bmea);
		}
Пример #28
0
		// Raises a message event to all registered loggers.
		public void LogMessageEvent (BuildMessageEventArgs e)
		{
			engine.EventSource.FireMessageRaised (this, e);
		}
Пример #29
0
        private void WriteMessage(string message)
        {
            BuildMessageEventArgs args = new BuildMessageEventArgs(message, string.Empty, typeof(WeaverTask).ToString(), MessageImportance.High);
            BuildEngine.LogMessageEvent(args);

            LogManager.GetCurrentClassLogger().Trace(message);
        }
Пример #30
0
        public void LoggingPacketReceived()
        {
            LoggingServicesLogMethod_Tests.ProcessBuildEventHelper loggingService = (LoggingServicesLogMethod_Tests.ProcessBuildEventHelper)LoggingServicesLogMethod_Tests.ProcessBuildEventHelper.CreateLoggingService(LoggerMode.Synchronous, 1);
            BuildMessageEventArgs messageEvent = new BuildMessageEventArgs("MyMessage", "HelpKeyword", "Sender", MessageImportance.High);
            LogMessagePacket packet = new LogMessagePacket(new KeyValuePair<int, BuildEventArgs>(1, messageEvent));
            loggingService.PacketReceived(1, packet);

            BuildMessageEventArgs messageEventFromPacket = loggingService.ProcessedBuildEvent as BuildMessageEventArgs;
            Assert.NotNull(messageEventFromPacket);
            Assert.Equal(messageEventFromPacket, messageEvent); // "Expected messages to match"
        }
Пример #31
0
 private void eventSource_MessageRaised(object sender, Microsoft.Build.Framework.BuildMessageEventArgs e)
 {
     textBox.Text += Environment.NewLine + e.Message;
 }
Пример #32
0
        /// <summary>
        /// This is the delegate for Message event types
        /// </summary>		
        protected virtual void MessageHandler(object sender, BuildMessageEventArgs messageEvent)
        {
            // NOTE: This may run on a background thread!
            QueueOutputEvent(messageEvent.Importance, messageEvent);
			if(messageEvent.Importance == MessageImportance.High)
				QueueTaskEvent(messageEvent);
        }
            public void LogMessageEvent(BuildMessageEventArgs eventArgs)
            {
                if (eventArgs == null)
                {
                    throw new ArgumentNullException("eventArgs");
                }

                log.Append(eventArgs.Message);
                log.Append("\n");

                ++messages;
            }
Пример #34
0
 public void LogMessageEvent(BuildMessageEventArgs eventArgs)
 {
     Console.WriteLine(eventArgs.Message);
     _log += eventArgs.Message;
     _log += "\n";
     ++_messages;
 }
Пример #35
0
 public void LogMessageEvent(Microsoft.Build.Framework.BuildMessageEventArgs e)
 {
 }