Beispiel #1
0
 private void eventSource_CustomEventRaised(object sender, Microsoft.Build.Framework.CustomBuildEventArgs e)
 {
     if (needToLog)
     {
         this.AddNode(e.Message);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Logs a custom event for the current task
        /// Thread safe.
        /// </summary>
        /// <param name="e">The event args</param>
        public void LogCustomEvent(Microsoft.Build.Framework.CustomBuildEventArgs 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);
            }
        }
Beispiel #3
0
        public void LogCustomEvent(CustomBuildEventArgs e)
        {
            if (trace)
            {
                TraceMessage(e.Message);
            }

            LoggedCustomEvents.Add(e);
        }
        /// <summary>
        /// Logs a custom event for the current task
        /// </summary>
        /// <param name="e">The event args</param>
        public void LogCustomEvent(Microsoft.Build.Framework.CustomBuildEventArgs 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);
        }
Beispiel #5
0
        public void LogCustomEvent()
        {
            var            expected = new CustomBuildEventArgs();
            BuildEventArgs anyEvent = null;

            Microsoft.Build.Framework.CustomBuildEventArgs customEvent = null;

            _engine.AnyEventRaised += (sender, args) =>
            {
                Assert.AreEqual(_engine, sender);
                anyEvent = args;
            };

            _engine.CustomEventRaised += (sender, args) =>
            {
                Assert.AreEqual(_engine, sender);
                customEvent = args;
            };

            _engine.LogCustomEvent(expected);

            Assert.AreEqual(expected, anyEvent);
            Assert.AreEqual(expected, customEvent);
        }
 /// <summary>
 /// This is the delegate for CustomHandler events.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="buildEvent"></param>
 protected virtual void CustomHandler(object sender, CustomBuildEventArgs buildEvent)
 {
     // NOTE: This may run on a background thread!
     QueueOutputEvent(MessageImportance.High, buildEvent);
 }
		/// <summary>
		/// This is the delegate for CustomHandler events.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="buildEvent"></param>
		private void CustomHandler(object sender, CustomBuildEventArgs buildEvent)
		{
            try
            {
                LogEvent(sender, buildEvent);
            }
            catch (Exception e)
            {
                Debug.Assert(false, "Problem logging custom event: " + e.Message + " at " + e.TargetSite);
                // swallow the exception
            }
		}
Beispiel #8
0
		// Raises a custom event to all registered loggers.
		public void LogCustomEvent (CustomBuildEventArgs e)
		{
			engine.EventSource.FireCustomEventRaised (this, e);
		}
 /// <summary>
 /// Sends the provided custom event back to the parent node to be logged, tagging it with 
 /// the parent node's ID so that, as far as anyone is concerned, it might as well have 
 /// just come from the parent node to begin with. 
 /// </summary>
 public void LogCustomEvent(CustomBuildEventArgs e)
 {
     SendBuildEvent(e);
 }
 /// <summary>
 /// Raises a custom event to all registered loggers.
 /// </summary>
 /// <param name="e">The event data.</param>
 public void LogCustomEvent(CustomBuildEventArgs e)
 {
     this.context.Information(e.Message);
 }
		public void LogCustomEvent(CustomBuildEventArgs e)
		{
		}
Beispiel #12
0
 /*
  * Method:    CustomHandler
  *
  * This is the delegate for CustomHandler events.
  *
  */
 private void CustomHandler(
     object sender,
     CustomBuildEventArgs buildEvent)
 {
     LogEvent(LoggerElements.Custom, sender, buildEvent);
 }
 /// <summary>
 /// Allows tasks to raise custom events to all registered loggers.
 /// The build engine may perform some filtering or
 /// pre-processing on the events, before dispatching them.
 /// </summary>
 /// <param name="e">Details of event to raise.</param>
 public void LogCustomEvent(CustomBuildEventArgs e)
 {
     OnLogBuildEvent(e);
 }
Beispiel #14
0
        private void eventSource_CustomEventRaised(object sender, CustomBuildEventArgs e)
        {
            if (stop) {
                return;
            }

            Execute(new BuildMessage(e));
            if (stop) {
                KillThyself();
            }
        }
 /// <summary>
 /// Prints a custom event
 /// </summary>
 public override void CustomEventHandler(object sender, CustomBuildEventArgs e)
 {
     // if verbosity is detailed or diagnostic
     if (IsVerbosityAtLeast(LoggerVerbosity.Detailed))
     {
         // ignore custom events with null messages -- some other
         // logger will handle them appropriately
         if (e.Message != null)
         {
             ShowDeferredMessages();
             WriteLinePretty(e.Message);
         }
     }
 }
 /// <summary>
 /// Unused.
 /// </summary>
 public void LogCustomEvent(CustomBuildEventArgs e)
 {
     throw new NotImplementedException();
 }
 void CustomEvent(object sender, CustomBuildEventArgs e)
 {
     //Do nothing, really a place holder for sub-classes
 }
Beispiel #18
0
 private void OnCustomEventRaised(object sender, CustomBuildEventArgs eventArgs)
 {
 }
Beispiel #19
0
 /// <summary>
 /// This is the delegate for CustomHandler events.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="buildEvent"></param>
 private void CustomHandler(object sender, CustomBuildEventArgs buildEvent)
 {
     LogEvent(sender, buildEvent);
 }
Beispiel #20
0
 public BuildMessage(CustomBuildEventArgs args)
 {
     EventType = args.GetType().Name.Replace("EventArgs", "");
     Message = args.Message;
     HelpKeyword = args.HelpKeyword;
     SenderName = args.SenderName;
     Timestamp = args.Timestamp;
     ThreadId = args.ThreadId;
 }
 private void eventSource_CustomEventRaised(object sender, Microsoft.Build.Framework.CustomBuildEventArgs e)
 {
     textBox.Text += Environment.NewLine + e.Message;
 }
Beispiel #22
0
		public void LogCustomEvent (CustomBuildEventArgs e)
		{
			event_source.FireCustomEventRaised (this, e);
		}
Beispiel #23
0
        /// <summary>
        /// Prints a custom event
        /// </summary>
        public void CustomEventHandler(object sender, CustomBuildEventArgs e)
        {
            InitializeBaseConsoleLogger(); // for compat: see DDB#136924

            _consoleLogger.CustomEventHandler(sender, e);
        }
Beispiel #24
0
 /// <summary>
 /// Log and record the number of custom build events.
 /// </summary>
 internal void MyCustomBuildHandler(object s, CustomBuildEventArgs e)
 {
     _numberOfCustom++;
     _lastCustom = e;
     if (e.Message != null)
     {
         Console.Out.WriteLine("CustomEvent:" + e.Message.ToString());
     }
 }
 public virtual void LogCustomEvent(CustomBuildEventArgs e)
 {
   throw new Exception("The method or operation is not implemented.");
 }
Beispiel #26
0
 public void LogCustomEvent(CustomBuildEventArgs e)
 {
     _log.LogMessage(e.Message);
 }
Beispiel #27
0
        /// <summary>
        /// Raises a custom event to all registered loggers.
        /// </summary>
        /// <param name="sender">sender of the event</param>
        /// <param name="buildEvent">CustomBuildEventArgs</param>
        /// <exception cref="LoggerException">When EventHandler raises an logger exception the LoggerException is rethrown</exception>
        /// <exception cref="InternalLoggerException">Any exceptions which are not LoggerExceptions are wrapped in an InternalLoggerException</exception>
        /// <exception cref="Exception">ExceptionHandling.IsCriticalException exceptions will not be wrapped</exception>
        private void RaiseCustomEvent(object sender, CustomBuildEventArgs buildEvent)
        {
            if (CustomEventRaised != null)
            {
                try
                {
                    CustomEventRaised(sender, buildEvent);
                }
                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.UnregisterAllEventHandlers();
                    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.UnregisterAllEventHandlers();

                    if (ExceptionHandling.IsCriticalException(exception))
                    {
                        throw;
                    }

                    InternalLoggerException.Throw(exception, buildEvent, "FatalErrorWhileLogging", false);
                }
            }

            RaiseAnyEvent(sender, buildEvent);
        }
 private void CustomBuildEventRaised(object sender, CustomBuildEventArgs e)
 {
     this.LogMessage("custom", e.Message, MessageImportance.Normal);
 }
			public void LogCustomEvent(CustomBuildEventArgs e)
			{
				LoggedMessages.Add(e.Message);
			}
Beispiel #30
0
 public abstract void CustomEventHandler(object sender, CustomBuildEventArgs e);
Beispiel #31
0
 public void LogCustomEvent(CustomBuildEventArgs e)
 {
     log.Info(e.Message);
 }
            public void LogCustomEvent(CustomBuildEventArgs eventArgs)
            {
                if (eventArgs == null)
                {
                    throw new ArgumentNullException("eventArgs");
                }

                if (!enableLog) return;

                log.Append(eventArgs.Message);
                log.Append("\n");
            }
 /// <summary>
 /// Handle a custom event, these are mostly user created events
 /// </summary>
 /// <param name="sender">Who sent the event</param>
 /// <param name="e">Event raised on the event source</param>
 private void Source_CustomEventRaised(object sender, CustomBuildEventArgs e)
 {
     HandleEvent(e);
 }
Beispiel #34
0
		private void eventSource_CustomBuildEventHandler(object sender, CustomBuildEventArgs e)
		{
            LogMessage(XmlLoggerElements.Custom, e.Message, MessageImportance.Normal, e.Timestamp);
		}
Beispiel #35
0
 public void LogCustomEvent(CustomBuildEventArgs e)
 {
     _customCount++;
     _customLog.AppendLine(e.Message);
     Console.WriteLine("Custom: {0}", e.Message);            
 }
Beispiel #36
0
 public void LogCustomEvent(CustomBuildEventArgs eventArgs)
 {
     Console.WriteLine(eventArgs.Message);
     _log += eventArgs.Message;
     _log += "\n";
 }
Beispiel #37
0
 public void LogCustomEvent(Microsoft.Build.Framework.CustomBuildEventArgs e)
 {
     throw new NotImplementedException();
 }