Skip to content

Commit a47ba19

Browse files
authored
Fix remarks formatting (#112808)
1 parent 6022adf commit a47ba19

File tree

1 file changed

+60
-55
lines changed

1 file changed

+60
-55
lines changed

src/libraries/Microsoft.Extensions.Logging.EventSource/src/LoggingEventSource.cs

Lines changed: 60 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -16,91 +16,96 @@ namespace Microsoft.Extensions.Logging.EventSource
1616
/// Bridges all ILogger-based logging to EventSource/EventListener logging.
1717
/// </summary>
1818
/// <remarks>
19-
/// You turn this logging on by enabling the EventSource called
20-
///
21-
/// Microsoft-Extensions-Logging
22-
///
23-
/// When you enabled the EventSource, the EventLevel you set is translated in the obvious way to the level
24-
/// associated with the ILogger (thus Debug = verbose, Informational = Informational ... Critical == Critical)
25-
///
26-
/// This allows you to filter by event level in a straightforward way.
27-
///
28-
/// For finer control you can specify a EventSource Argument called
29-
///
30-
/// FilterSpecs
31-
///
32-
/// The FilterSpecs argument is a semicolon separated list of specifications. Where each specification is
33-
///
34-
/// SPEC = // empty spec, same as *
35-
/// | NAME // Just a name the level is the default level
36-
/// | NAME : LEVEL // specifies level for a particular logger (can have a * suffix).
37-
///
38-
/// When "UseAppFilters" is specified in the FilterSpecs, it avoids disabling all categories which happens by default otherwise.
39-
///
40-
/// Where Name is the name of a ILoggger (case matters), Name can have a * which acts as a wildcard
41-
/// AS A SUFFIX. Thus Net* will match any loggers that start with the 'Net'.
42-
///
43-
/// The LEVEL is a number or a LogLevel string. 0=Trace, 1=Debug, 2=Information, 3=Warning, 4=Error, Critical=5
44-
/// This specifies the level for the associated pattern. If the number is not specified, (first form
45-
/// of the specification) it is the default level for the EventSource.
46-
///
47-
/// First match is used if a particular name matches more than one pattern.
48-
///
49-
/// In addition the level and FilterSpec argument, you can also set EventSource Keywords. See the Keywords
50-
/// definition below, but basically you get to decide if you wish to have
51-
///
52-
/// * Keywords.Message - You get the event with the data in parsed form.
53-
/// * Keywords.JsonMessage - you get an event with the data in parse form but as a JSON blob (not broken up by argument ...)
54-
/// * Keywords.FormattedMessage - you get an event with the data formatted as a string
55-
///
56-
/// It is expected that you will turn only one of these keywords on at a time, but you can turn them all on (and get
57-
/// the same data logged three different ways.
58-
///
59-
/// Example Usage
60-
///
61-
/// This example shows how to use an EventListener to get ILogging information
62-
///
19+
/// <para>
20+
/// To turn this logging on, you enable the EventSource called <c>Microsoft-Extensions-Logging</c>. When you enable the EventSource, the EventLevel you set is translated in to the level associated with the ILogger (thus <c>Debug</c> = <c>verbose</c>, <c>Informational</c> = <c>Informational</c>, <c>Critical</c> == <c>Critical</c>). This allows you to filter by event level in a straightforward way.
21+
/// </para>
22+
/// <para>
23+
/// For finer control, you can specify an EventSource argument called <c>FilterSpecs</c>. The <c>FilterSpecs</c> argument is a semicolon-separated list of specifications. Where each specification is:
24+
/// </para>
25+
/// <para>
26+
/// SPEC = // Empty spec, same as *.
27+
/// </para>
28+
/// <para>
29+
/// | NAME // Named spec. Uses the default level.
30+
/// </para>
31+
/// <para>
32+
/// | NAME : LEVEL // Specifies level for a particular logger (can have a * suffix).
33+
/// </para>
34+
/// <para>
35+
/// When "UseAppFilters" is specified in the <c>FilterSpecs</c>, it avoids disabling all categories, which happens by default otherwise.
36+
/// </para>
37+
/// <para>
38+
/// <c>Name</c> is the name of an <see cref="ILogger"/> (case matters), and can end with *, which acts as a wildcard. For example, <c>Net*</c> will match any loggers that start with 'Net'.
39+
/// </para>
40+
/// <para>
41+
/// <c>LEVEL</c> is a number or a <see cref="LogLevel"/> string (0=Trace, 1=Debug, 2=Information, 3=Warning, 4=Error, Critical=5). This specifies the level for the associated pattern. If the number isn't specified (first form of the specification), it's the default level for the EventSource.
42+
/// </para>
43+
/// <para>
44+
/// The first match is used if a particular name matches more than one pattern.
45+
/// </para>
46+
/// <para>
47+
/// In addition to the level and <c>FilterSpecs</c> argument, you can also set EventSource keywords:
48+
/// </para>
49+
/// <para>
50+
/// * Keywords.Message - Event contains data in parsed form.
51+
/// </para>
52+
/// <para>
53+
/// * Keywords.JsonMessage - Event contains data in parsed form but as a JSON blob (not broken up by argument).
54+
/// </para>
55+
/// <para>
56+
/// * Keywords.FormattedMessage - Event contains data formatted as a string.
57+
/// </para>
58+
/// <para>
59+
/// It's expected that only one of these keywords is turned on at a time, but you can turn them all on (and get
60+
/// the same data logged three different ways).
61+
/// </para>
62+
/// </remarks>
63+
/// <example>
64+
/// This example shows how to use an EventListener to get ILogging information.
65+
/// <code language="csharp">
6366
/// class MyEventListener : EventListener {
6467
/// protected override void OnEventSourceCreated(EventSource eventSource) {
6568
/// if (eventSource.Name == "Microsoft-Extensions-Logging") {
66-
/// // initialize a string, string dictionary of arguments to pass to the EventSource.
67-
/// // Turn on loggers matching App* to Information, everything else (*) is the default level (which is EventLevel.Error)
69+
/// // Initialize a dictionary of arguments to pass to the EventSource.
70+
/// // Turn on loggers matching App* to Information; everything else (*) is the default level (which is EventLevel.Error).
6871
/// var args = new Dictionary&lt;string, string&gt;() { { "FilterSpecs", "App*:Information;*" } };
6972
/// // Set the default level (verbosity) to Error, and only ask for the formatted messages in this case.
7073
/// EnableEvents(eventSource, EventLevel.Error, LoggingEventSource.Keywords.FormattedMessage, args);
7174
/// }
7275
/// }
7376
/// protected override void OnEventWritten(EventWrittenEventArgs eventData) {
74-
/// // Look for the formatted message event, which has the following argument layout (as defined in the LoggingEventSource.
77+
/// // Look for the formatted message event, which has the following argument layout (as defined in the LoggingEventSource):
7578
/// // FormattedMessage(LogLevel Level, int FactoryID, string LoggerName, string EventId, string FormattedMessage);
7679
/// if (eventData.EventName == "FormattedMessage")
77-
/// Console.WriteLine("Logger {0}: {1}", eventData.Payload[2], eventData.Payload[4]);
80+
/// Console.WriteLine($"Logger {eventData.Payload[2]}: {eventData.Payload[4]}");
7881
/// }
7982
/// }
80-
/// </remarks>
83+
/// </code>
84+
/// </example>
8185
[EventSource(Name = "Microsoft-Extensions-Logging")]
8286
public sealed class LoggingEventSource : System.Diagnostics.Tracing.EventSource
8387
{
8488
/// <summary>
85-
/// This is public from an EventSource consumer point of view, but since these definitions
86-
/// are not needed outside this class
89+
/// Defines the different ways data can be formatted in an event.
8790
/// </summary>
91+
// This is public from an EventSource consumer point of view,
92+
// but these definitions aren't needed outside this class.
8893
public static class Keywords
8994
{
9095
/// <summary>
91-
/// Meta events are events about the LoggingEventSource itself (that is they did not come from ILogger
96+
/// Events about the LoggingEventSource itself (that is, they did not come from ILogger).
9297
/// </summary>
9398
public const EventKeywords Meta = (EventKeywords)1;
9499
/// <summary>
95-
/// Turns on the 'Message' event when ILogger.Log() is called. It gives the information in a programmatic (not formatted) way
100+
/// Turns on the 'Message' event when ILogger.Log() is called. Provides information in a programmatic (unformatted) way.
96101
/// </summary>
97102
public const EventKeywords Message = (EventKeywords)2;
98103
/// <summary>
99-
/// Turns on the 'FormatMessage' event when ILogger.Log() is called. It gives the formatted string version of the information.
104+
/// Turns on the 'FormatMessage' event when ILogger.Log() is called. Provides the formatted string version of the information.
100105
/// </summary>
101106
public const EventKeywords FormattedMessage = (EventKeywords)4;
102107
/// <summary>
103-
/// Turns on the 'MessageJson' event when ILogger.Log() is called. It gives JSON representation of the Arguments.
108+
/// Turns on the 'MessageJson' event when ILogger.Log() is called. Provides a JSON representation of the Arguments.
104109
/// </summary>
105110
public const EventKeywords JsonMessage = (EventKeywords)8;
106111
}

0 commit comments

Comments
 (0)