예제 #1
0
 private void eventSource_CustomEventRaised(object sender, Microsoft.Build.Framework.CustomBuildEventArgs e)
 {
     if (needToLog)
     {
         this.AddNode(e.Message);
     }
 }
예제 #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);
            }
        }
예제 #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);
        }
예제 #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);
        }
예제 #6
0
 /// <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);
 }
예제 #7
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)
		{
            try
            {
                LogEvent(sender, buildEvent);
            }
            catch (Exception e)
            {
                Debug.Assert(false, "Problem logging custom event: " + e.Message + " at " + e.TargetSite);
                // swallow the exception
            }
		}
예제 #8
0
		// Raises a custom event to all registered loggers.
		public void LogCustomEvent (CustomBuildEventArgs e)
		{
			engine.EventSource.FireCustomEventRaised (this, e);
		}
예제 #9
0
 /// <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);
 }
예제 #10
0
 /// <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);
 }
예제 #11
0
		public void LogCustomEvent(CustomBuildEventArgs e)
		{
		}
예제 #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);
 }
예제 #14
0
        private void eventSource_CustomEventRaised(object sender, CustomBuildEventArgs e)
        {
            if (stop) {
                return;
            }

            Execute(new BuildMessage(e));
            if (stop) {
                KillThyself();
            }
        }
예제 #15
0
 /// <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);
         }
     }
 }
예제 #16
0
 /// <summary>
 /// Unused.
 /// </summary>
 public void LogCustomEvent(CustomBuildEventArgs e)
 {
     throw new NotImplementedException();
 }
예제 #17
0
 void CustomEvent(object sender, CustomBuildEventArgs e)
 {
     //Do nothing, really a place holder for sub-classes
 }
예제 #18
0
 private void OnCustomEventRaised(object sender, CustomBuildEventArgs eventArgs)
 {
 }
예제 #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);
 }
예제 #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;
 }
예제 #21
0
 private void eventSource_CustomEventRaised(object sender, Microsoft.Build.Framework.CustomBuildEventArgs e)
 {
     textBox.Text += Environment.NewLine + e.Message;
 }
예제 #22
0
		public void LogCustomEvent (CustomBuildEventArgs e)
		{
			event_source.FireCustomEventRaised (this, e);
		}
예제 #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);
        }
예제 #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.");
 }
예제 #26
0
 public void LogCustomEvent(CustomBuildEventArgs e)
 {
     _log.LogMessage(e.Message);
 }
예제 #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);
			}
예제 #30
0
 public abstract void CustomEventHandler(object sender, CustomBuildEventArgs e);
예제 #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");
            }
예제 #33
0
 /// <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);
 }
예제 #34
0
		private void eventSource_CustomBuildEventHandler(object sender, CustomBuildEventArgs e)
		{
            LogMessage(XmlLoggerElements.Custom, e.Message, MessageImportance.Normal, e.Timestamp);
		}
예제 #35
0
 public void LogCustomEvent(CustomBuildEventArgs e)
 {
     _customCount++;
     _customLog.AppendLine(e.Message);
     Console.WriteLine("Custom: {0}", e.Message);            
 }
예제 #36
0
 public void LogCustomEvent(CustomBuildEventArgs eventArgs)
 {
     Console.WriteLine(eventArgs.Message);
     _log += eventArgs.Message;
     _log += "\n";
 }
예제 #37
0
 public void LogCustomEvent(Microsoft.Build.Framework.CustomBuildEventArgs e)
 {
     throw new NotImplementedException();
 }