summaryrefslogtreecommitdiff
path: root/src/Task/Logger/ITaskLogger.cs
blob: 7333f7827834856c3387720dbf9095db04fb5e28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System;

using Microsoft.Build.Framework;

namespace AggregateConfigBuildTask
{
    /// <summary>
    /// Interface for task logging helper methods.
    /// </summary>
    public interface ITaskLogger
    {
        /// <summary>
        /// Logs an error message.
        /// </summary>
        /// <param name="message">The error message to log.</param>
        /// <param name="messageArgs">Optional arguments for formatting the message.</param>
        void LogError(string message = null, params object[] messageArgs);

        /// <summary>
        /// Logs an error message from an exception.
        /// </summary>
        /// <param name="exception">The exception to log.</param>
        /// <param name="showStackTrace">Indicates whether to show the stack trace.</param>
        /// <param name="showDetail">Indicates whether to show detailed information.</param>
        /// <param name="file">The file where the exception occurred.</param>
        void LogErrorFromException(Exception exception,
            bool showStackTrace = false,
            bool showDetail = false,
            string file = null);

        /// <summary>
        /// Logs a warning message.
        /// </summary>
        /// <param name="message">The warning message to log.</param>
        /// <param name="messageArgs">Optional arguments for formatting the message.</param>
        void LogWarning(string message = null, params object[] messageArgs);

        /// <summary>
        /// Logs a warning message with additional parameters.
        /// </summary>
        /// <param name="subcategory">The subcategory of the warning.</param>
        /// <param name="warningCode">The warning code.</param>
        /// <param name="helpKeyword">The help keyword associated with the warning.</param>
        /// <param name="file">The file in which the warning occurred.</param>
        /// <param name="lineNumber">The line number where the warning occurred.</param>
        /// <param name="columnNumber">The column number where the warning occurred.</param>
        /// <param name="endLineNumber">The end line number of the warning.</param>
        /// <param name="endColumnNumber">The end column number of the warning.</param>
        /// <param name="message">The warning message to log.</param>
        /// <param name="messageArgs">Optional arguments for formatting the message.</param>
        void LogWarning(
            string subcategory = null,
            string warningCode = null,
            string helpKeyword = null,
            string file = null,
            int lineNumber = 0,
            int columnNumber = 0,
            int endLineNumber = 0,
            int endColumnNumber = 0,
            string message = null,
            params object[] messageArgs);

        /// <summary>
        /// Logs a message with specified importance.
        /// </summary>
        /// <param name="importance">The importance level of the message.</param>
        /// <param name="message">The message to log.</param>
        /// <param name="messageArgs">Optional arguments for formatting the message.</param>
        void LogMessage(MessageImportance importance = MessageImportance.Normal, string message = null, params object[] messageArgs);
    }
}