Skip to content

Commit 77b3704

Browse files
committed
Add xmldoc to LogMessage
1 parent 67df837 commit 77b3704

File tree

1 file changed

+60
-1
lines changed

1 file changed

+60
-1
lines changed

src/Azure.Functions.Sdk/LogMessage.cs

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,63 @@
66

77
namespace Azure.Functions.Sdk;
88

9+
/// <summary>
10+
/// A helper struct representing a log message for MSBuild tasks.
11+
/// </summary>
912
internal readonly struct LogMessage
1013
{
14+
/// <summary>
15+
/// Log message for when the Func CLI cannot be run.
16+
/// </summary>
1117
public static readonly LogMessage Error_CannotRunFuncCli
1218
= new(nameof(Strings.AZFW0100_Error_CannotRunFuncCli));
1319

20+
/// <summary>
21+
/// Log message for when there is a conflict between extension packages.
22+
/// </summary>
1423
public static readonly LogMessage Error_ExtensionPackageConflict
1524
= new(nameof(Strings.AZFW0101_Error_ExtensionPackageConflict));
1625

26+
/// <summary>
27+
/// Log message for when there is a duplicate extension package.
28+
/// </summary>
1729
public static readonly LogMessage Warning_ExtensionPackageDuplicate
1830
= new(nameof(Strings.AZFW0102_Warning_ExtensionPackageDuplicate));
1931

32+
/// <summary>
33+
/// Log message for when an extension package version is invalid.
34+
/// </summary>
2035
public static readonly LogMessage Error_InvalidExtensionPackageVersion
2136
= new(nameof(Strings.AZFW0103_Error_InvalidExtensionPackageVersion));
2237

38+
/// <summary>
39+
/// Log message for when an end-of-life Functions version is used.
40+
/// </summary>
2341
public static readonly LogMessage Warning_EndOfLifeFunctionsVersion
2442
= new(nameof(Strings.AZFW0104_Warning_EndOfLifeFunctionsVersion));
2543

44+
/// <summary>
45+
/// Log message for when an incompatible Functions SDK is used.
46+
/// </summary>
2647
public static readonly LogMessage Error_UsingIncompatibleSdk
2748
= new(nameof(Strings.AZFW0105_Error_UsingIncompatibleSdk));
2849

50+
/// <summary>
51+
/// Log message for when an unknown Functions version is specified.
52+
/// </summary>
2953
public static readonly LogMessage Error_UnknownFunctionsVersion
3054
= new(nameof(Strings.AZFW0106_Error_UnknownFunctionsVersion));
3155

56+
/// <summary>
57+
/// Log message for when an unsupported target framework is used.
58+
/// </summary>
3259
public static readonly LogMessage Warning_UnsupportedTargetFramework
3360
= new(nameof(Strings.AZFW0107_Warning_UnsupportedTargetFramework));
3461

3562
/// <summary>
3663
/// Initializes a new instance of the <see cref="LogMessage"/> struct.
3764
/// Parses the <see cref="Level"/> and <see cref="Code"/> properties from the given <paramref name="id"/>.
38-
/// LogCodes must:
65+
/// LogMessages must:
3966
/// - Be defined in the 'Strings.resx' file with the identifier <paramref name="id"/>.
4067
/// - Follow the format: (?:<LogCode>_)(?<LogLevel>_).*
4168
/// </summary>
@@ -59,12 +86,33 @@ public LogMessage(LogLevel level, string id, string? code = null)
5986
Code = code;
6087
}
6188

89+
/// <summary>
90+
/// Gets the level of the log message.
91+
/// </summary>
6292
public LogLevel Level { get; }
6393

94+
/// <summary>
95+
/// Gets the identifier of the log message.
96+
/// </summary>
97+
/// <remarks>
98+
/// This identifier must correspond to a resource string in the <see cref="Strings"/> resource file.
99+
/// </remarks>
64100
public string Id { get; }
65101

102+
/// <summary>
103+
/// Gets the code of the log message, if available.
104+
/// </summary>
66105
public string? Code { get; }
67106

107+
/// <summary>
108+
/// Gets the help keyword for the log message.
109+
/// </summary>
110+
/// <remarks>
111+
/// The help keyword is derived from the <see cref="Code"/> property.
112+
/// If the <see cref="Code"/> is null, the help keyword will also be null.
113+
/// A help keyword will emit a help link of "https://go.microsoft.com/fwlink/?LinkId=AzureFunctions.{Code}"
114+
/// as part of the msbuild log.
115+
/// </remarks>
68116
public string? HelpKeyword => Code is null ? null : $"AzureFunctions.{Code}";
69117

70118
/// <summary>
@@ -89,8 +137,19 @@ public static LogMessage FromId(string id)
89137
};
90138
}
91139

140+
/// <summary>
141+
/// Formats the log message with the given arguments and <see cref="CultureInfo.CurrentUICulture" />.
142+
/// </summary>
143+
/// <param name="args">The arguments to use, if any.</param>
144+
/// <returns>The formatted message.</returns>
92145
public string Format(params object[] args) => Format(CultureInfo.CurrentUICulture, args);
93146

147+
/// <summary>
148+
/// Formats the log message with the given culture and arguments.
149+
/// </summary>
150+
/// <param name="culture">The culture info to use.</param>
151+
/// <param name="args"></param>
152+
/// <returns>The formatted message.</returns>
94153
public string Format(CultureInfo culture, params object[] args)
95154
{
96155
string resource = Strings.GetResourceString(Id)

0 commit comments

Comments
 (0)