Class SimpleMessage
A plain IMessage with no anchor: severity, category, id, notification text and
optional detail. This is the default carrier for ad-hoc messages that have no other home.
When step context is available, a step-anchored decorator wraps a SimpleMessage
to add the StepIndex / SentenceCarrier without the producer needing to know it.
public class SimpleMessage : IMessage
- Inheritance
-
SimpleMessage
- Implements
- Inherited Members
- Extension Methods
Constructors
SimpleMessage(Severity, FormattableString, Category, string, object)
Initializes a templated instance: the interpolated template and its values are kept on
Format / Args and Notification becomes the
culture-invariant English rendering. An interpolated string literal passed to the
string constructor is NOT captured here — call sites opt in through the
*Fmt helpers on MessageUtil.
public SimpleMessage(Severity severity, FormattableString notification, Category category = Category.System, string id = null, object detail = null)
Parameters
severitySeverityImportance level.
notificationFormattableStringInterpolated notification template.
categoryCategoryClassification; defaults to System.
idstringOptional structured id.
detailobjectOptional detail payload or exception.
SimpleMessage(Severity, string, Category, string, object)
Initializes a new instance of the SimpleMessage class.
public SimpleMessage(Severity severity, string notification, Category category = Category.System, string id = null, object detail = null)
Parameters
severitySeverityImportance level.
notificationstringEnd-user friendly notification text.
categoryCategoryClassification; defaults to System.
idstringOptional structured id.
detailobjectOptional detail payload or exception.
Properties
Args
Gets the values interpolated into Format; null when untemplated.
public object[] Args { get; }
Property Value
- object[]
Category
Gets the classification.
public Category Category { get; }
Property Value
Detail
Gets the optional detail payload or exception; null when not applicable.
public object Detail { get; }
Property Value
Format
Gets the composite-format template behind Notification; null when the message was built from a plain string (untemplated).
public string Format { get; }
Property Value
Id
Gets the structured id for filtering / suppression; may be null.
public string Id { get; }
Property Value
Notification
Gets the end-user friendly notification text.
public string Notification { get; }
Property Value
Severity
Gets the importance level.
public Severity Severity { get; }
Property Value
Methods
GetArgs()
Gets the values interpolated into GetFormat(); null when GetFormat() is null, possibly empty for a hole-less template. Default interface method so external implementers are unaffected.
public object[] GetArgs()
Returns
- object[]
The interpolation arguments, or null when untemplated.
GetCategory()
Gets the classification — see Category.
public Category GetCategory()
Returns
- Category
The category of this message.
GetDetail()
Gets the optional detail payload or exception; null when not applicable.
public object GetDetail()
Returns
- object
The detail object, or null.
GetFormat()
Gets the composite-format template behind GetNotification() — a
{0}-style .NET format string — when this message was produced from an
interpolated template; null when the notification has no structured template.
Together with GetArgs() this lets a consumer re-render the message
in another language without losing the interpolated live values, while
GetNotification() stays the invariant English rendering.
Default interface method so external implementers are unaffected.
public string GetFormat()
Returns
- string
The composite format string, or null when untemplated.
GetId()
Gets the structured id used for filtering / suppression; may be null.
public string GetId()
Returns
- string
The message id, or null when not applicable.
GetNotification()
Gets the end-user friendly notification text.
public string GetNotification()
Returns
- string
The notification text.
GetSeverity()
Gets the importance level — see Severity.
public Severity GetSeverity()
Returns
- Severity
The severity of this message.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.