/// <summary>
 /// Log a warning based on a text message
 /// </summary>
 /// <param name="subcategoryResourceName">The subcategory resource name</param>
 /// <param name="warningCode"> Warning code</param>
 /// <param name="helpKeyword"> Help keyword</param>
 /// <param name="file">The file in which the warning occurred</param>
 /// <param name="message">The message to be logged as a warning</param>
 internal void LogWarningFromText(string subcategoryResourceName, string warningCode, string helpKeyword, BuildEventFileInfo file, string message)
 {
     ErrorUtilities.VerifyThrow(_isValid, "must be valid");
     _loggingService.LogWarningFromText(_eventContext, subcategoryResourceName, warningCode, helpKeyword, file, message);
 }
 /// <summary>
 /// Log an error based on an exception
 /// </summary>
 /// <param name="exception">The exception wich is to be logged</param>
 /// <param name="file">The file in which the error occurred</param>
 /// <param name="messageResourceName">The string resource which has the formatting string for the error</param>
 /// <param name="messageArgs">The arguments for the error message</param>
 internal void LogFatalError(Exception exception, BuildEventFileInfo file, string messageResourceName, params object[] messageArgs)
 {
     ErrorUtilities.VerifyThrow(_isValid, "must be valid");
     _loggingService.LogFatalError(_eventContext, exception, file, messageResourceName, messageArgs);
     _hasLoggedErrors = true;
 }
 /// <summary>
 /// Log a warning
 /// </summary>
 /// <param name="subcategoryResourceName">The subcategory resource name</param>
 /// <param name="file">The file in which the warning occurred</param>
 /// <param name="messageResourceName">The string resource which contains the formatted warning string</param>
 /// <param name="messageArgs">parameters for the string resource</param>
 internal void LogWarning(string subcategoryResourceName, BuildEventFileInfo file, string messageResourceName, params object[] messageArgs)
 {
     ErrorUtilities.VerifyThrow(_isValid, "must be valid");
     _loggingService.LogWarning(_eventContext, subcategoryResourceName, file, messageResourceName, messageArgs);
 }
        public void LogFatalError(BuildEventContext buildEventContext, Exception exception, BuildEventFileInfo file, string messageResourceName, params object[] messageArgs)
        {
            ErrorUtilities.VerifyThrow(!string.IsNullOrEmpty(messageResourceName), "Need resource string for error message.");

            string message = ResourceUtilities.FormatResourceStringStripCodeAndKeyword(out string errorCode, out string helpKeyword, messageResourceName, messageArgs);

#if DEBUG
            message += Environment.NewLine + "This is an unhandled exception from a task -- PLEASE OPEN A BUG AGAINST THE TASK OWNER.";
#endif
            if (exception != null)
            {
                message += Environment.NewLine + exception.ToString();
            }

            LogErrorFromText(buildEventContext, null, errorCode, helpKeyword, file, message);
        }
        public void LogTaskWarningFromException(BuildEventContext buildEventContext, Exception exception, BuildEventFileInfo file, string taskName)
        {
            ErrorUtilities.VerifyThrow(!String.IsNullOrEmpty(taskName), "Must specify the name of the task that failed.");

            string message = ResourceUtilities.FormatResourceStringStripCodeAndKeyword(out string warningCode, out string helpKeyword, "FatalTaskError", taskName);

#if DEBUG
            message += Environment.NewLine + "This is an unhandled exception from a task -- PLEASE OPEN A BUG AGAINST THE TASK OWNER.";
#endif

            if (exception != null)
            {
                message += Environment.NewLine + exception.ToString();
            }

            LogWarningFromText(buildEventContext, null, warningCode, helpKeyword, file, message);
        }
Example #6
0
        public void LogErrorFromText(BuildEventContext buildEventContext, string subcategoryResourceName, string errorCode, string helpKeyword, BuildEventFileInfo file, string message)
        {
            lock (_lockObject)
            {
                ErrorUtilities.VerifyThrow(buildEventContext != null, "Must specify the buildEventContext");
                ErrorUtilities.VerifyThrow(file != null, "Must specify the associated file.");
                ErrorUtilities.VerifyThrow(message != null, "Need error message.");

                string subcategory = null;

                if (subcategoryResourceName != null)
                {
                    subcategory = AssemblyResources.GetString(subcategoryResourceName);
                }

                BuildErrorEventArgs buildEvent =
                    new BuildErrorEventArgs
                    (
                        subcategory,
                        errorCode,
                        file.File,
                        file.Line,
                        file.Column,
                        file.EndLine,
                        file.EndColumn,
                        message,
                        helpKeyword,
                        "MSBuild"
                    );

                buildEvent.BuildEventContext = buildEventContext;
                if (buildEvent.ProjectFile == null && buildEventContext.ProjectContextId != BuildEventContext.InvalidProjectContextId)
                {
                    _projectFileMap.TryGetValue(buildEventContext.ProjectContextId, out string projectFile);
                    ErrorUtilities.VerifyThrow(projectFile != null, "ContextID {0} should have been in the ID-to-project file mapping but wasn't!", buildEventContext.ProjectContextId);
                    buildEvent.ProjectFile = projectFile;
                }

                ProcessLoggingEvent(buildEvent);
            }
        }
Example #7
0
 /// <summary>
 /// Logs a warning
 /// </summary>
 /// <param name="buildEventContext">The event context</param>
 /// <param name="subcategoryResourceName">The subcategory resource</param>
 /// <param name="file">The file</param>
 /// <param name="messageResourceName">The message resource</param>
 /// <param name="messageArgs">The message args</param>
 public void LogWarning(BuildEventContext buildEventContext, string subcategoryResourceName, BuildEventFileInfo file, string messageResourceName, params object[] messageArgs)
 {
 }
Example #8
0
 /// <summary>
 /// Logs a text warning
 /// </summary>
 /// <param name="buildEventContext">The build context</param>
 /// <param name="subcategoryResourceName">The subcategory resource</param>
 /// <param name="warningCode">The warning code</param>
 /// <param name="helpKeyword">A help keyword</param>
 /// <param name="file">The file</param>
 /// <param name="message">The message</param>
 public void LogWarningFromText(BuildEventContext buildEventContext, string subcategoryResourceName, string warningCode, string helpKeyword, BuildEventFileInfo file, string message)
 {
     Console.WriteLine(message);
 }
 /// <summary>
 /// Log a warning based on an exception
 /// </summary>
 /// <param name="exception">The exception to be logged as a warning</param>
 /// <param name="file">The file in which the warning occurred</param>
 /// <param name="taskName">The task in which the warning occurred</param>
 internal void LogTaskWarningFromException(Exception exception, BuildEventFileInfo file, string taskName)
 {
     ErrorUtilities.VerifyThrow(IsValid, "must be valid");
     LoggingService.LogTaskWarningFromException(BuildEventContext, exception, file, taskName);
 }
Example #10
0
 /// <summary>
 /// Logs a task warning
 /// </summary>
 /// <param name="buildEventContext">The build context</param>
 /// <param name="exception">The exception</param>
 /// <param name="file">The file</param>
 /// <param name="taskName">The name of the task</param>
 public void LogTaskWarningFromException(BuildEventContext buildEventContext, Exception exception, BuildEventFileInfo file, string taskName)
 {
 }
Example #11
0
 /// <summary>
 /// Logs a warning
 /// </summary>
 /// <param name="buildEventContext">The event context</param>
 /// <param name="subcategoryResourceName">The subcategory resource</param>
 /// <param name="file">The file</param>
 /// <param name="messageResourceName">The message resource</param>
 /// <param name="messageArgs">The message args</param>
 public void LogWarning(BuildEventContext buildEventContext, string subcategoryResourceName, BuildEventFileInfo file, string messageResourceName, params object[] messageArgs)
 {
     Console.WriteLine(messageResourceName);
     foreach (object o in messageArgs)
     {
         Console.WriteLine((string)o);
     }
 }
Example #12
0
 /// <summary>
 /// Logs a generic fatal error
 /// </summary>
 /// <param name="buildEventContext">The build context</param>
 /// <param name="exception">The exception</param>
 /// <param name="file">The file</param>
 /// <param name="messageResourceName">The message resource</param>
 /// <param name="messageArgs">The message args</param>
 public void LogFatalError(BuildEventContext buildEventContext, Exception exception, BuildEventFileInfo file, string messageResourceName, params object[] messageArgs)
 {
 }
Example #13
0
 /// <summary>
 /// Logs a fatal task error
 /// </summary>
 /// <param name="buildEventContext">The event context</param>
 /// <param name="exception">The exception</param>
 /// <param name="file">The file</param>
 /// <param name="taskName">The name of the task</param>
 public void LogFatalTaskError(BuildEventContext buildEventContext, Exception exception, BuildEventFileInfo file, string taskName)
 {
 }
Example #14
0
 /// <summary>
 /// Logs a fatal build error
 /// </summary>
 /// <param name="buildEventContext">The event context</param>
 /// <param name="exception">The exception</param>
 /// <param name="file">The file</param>
 public void LogFatalBuildError(BuildEventContext buildEventContext, Exception exception, BuildEventFileInfo file)
 {
 }
 /// <summary>
 /// Log an error based on an exception
 /// </summary>
 /// <param name="exception">The exception to be logged</param>
 /// <param name="file">The file in which the error occurred</param>
 internal void LogFatalBuildError(Exception exception, BuildEventFileInfo file)
 {
     ErrorUtilities.VerifyThrow(IsValid, "must be valid");
     LoggingService.LogFatalBuildError(BuildEventContext, exception, file);
     _hasLoggedErrors = true;
 }
 public void LogError(BuildEventContext location, BuildEventFileInfo file, string messageResourceName, params object[] messageArgs)
 {
     LogError(location, null, file, messageResourceName, messageArgs);
 }
Example #17
0
        public void LogError(BuildEventContext buildEventContext, string subcategoryResourceName, BuildEventFileInfo file, string messageResourceName, params object[] messageArgs)
        {
            lock (_lockObject)
            {
                ErrorUtilities.VerifyThrow(!string.IsNullOrEmpty(messageResourceName), "Need resource string for error message.");

                string message = ResourceUtilities.FormatResourceStringStripCodeAndKeyword(out string errorCode, out string helpKeyword, messageResourceName, messageArgs);

                LogErrorFromText(buildEventContext, subcategoryResourceName, errorCode, helpKeyword, file, message);
            }
        }
        public void LogFatalTaskError(BuildEventContext buildEventContext, Exception exception, BuildEventFileInfo file, string taskName)
        {
            ErrorUtilities.VerifyThrow(taskName != null, "Must specify the name of the task that failed.");

            LogFatalError(buildEventContext, exception, file, "FatalTaskError", taskName);
        }
Example #19
0
 public void LogFatalBuildError(BuildEventContext buildEventContext, Exception exception, BuildEventFileInfo file)
 {
     lock (_lockObject)
     {
         LogFatalError(buildEventContext, exception, file, "FatalBuildError");
     }
 }
Example #20
0
 /// <summary>
 /// Logs a text error
 /// </summary>
 /// <param name="buildEventContext">The event context</param>
 /// <param name="subcategoryResourceName">The subcategory resource</param>
 /// <param name="errorCode">The error code</param>
 /// <param name="helpKeyword">A help keyword</param>
 /// <param name="file">The file</param>
 /// <param name="message">The message</param>
 public void LogErrorFromText(BuildEventContext buildEventContext, string subcategoryResourceName, string errorCode, string helpKeyword, BuildEventFileInfo file, string message)
 {
 }