상속: net.r_eg.IeXod.Framework.LazyFormattedBuildEventArgs
예제 #1
0
        /// <summary>
        /// Logs an error event for the current task
        /// </summary>
        /// <param name="e">The event args</param>
        public void LogErrorEvent(net.r_eg.IeXod.Framework.BuildErrorEventArgs 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);
        }
예제 #2
0
파일: TaskHost.cs 프로젝트: 3F/IeXod
        /// <summary>
        /// Logs an error event for the current task
        /// Thread safe.
        /// </summary>
        /// <param name="e">The event args</param>
        public void LogErrorEvent(net.r_eg.IeXod.Framework.BuildErrorEventArgs 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;
                }

                if (_convertErrorsToWarnings)
                {
                    // Convert the error into a warning.  We do this because the whole point of
                    // ContinueOnError is that a project author expects that the task might fail,
                    // but wants to ignore the failures.  This implies that we shouldn't be logging
                    // errors either, because you should never have a successful build with errors.
                    BuildWarningEventArgs warningEvent = new BuildWarningEventArgs
                                                         (
                        e.Subcategory,
                        e.Code,
                        e.File,
                        e.LineNumber,
                        e.ColumnNumber,
                        e.EndLineNumber,
                        e.EndColumnNumber,
                        e.Message,
                        e.HelpKeyword,
                        e.SenderName
                                                         );

                    warningEvent.BuildEventContext = _taskLoggingContext.BuildEventContext;
                    _taskLoggingContext.LoggingService.LogBuildEvent(warningEvent);

                    // Log a message explaining why we converted the previous error into a warning.
                    _taskLoggingContext.LoggingService.LogComment(_taskLoggingContext.BuildEventContext, MessageImportance.Normal, "ErrorConvertedIntoWarning");
                }
                else
                {
                    e.BuildEventContext = _taskLoggingContext.BuildEventContext;
                    _taskLoggingContext.LoggingService.LogBuildEvent(e);
                    _taskLoggingContext.HasLoggedErrors = true;
                }
            }
        }