Class DiagnosticMessageFactory
Represents a class that can be used to create instances of classes deriving from the DiagnosticMessage class. The main benefit of using this class is automatic and consistent message identifier generation.
Inheritance
Inherited Members
Namespace: Juhta.Net.Diagnostics
Assembly: Juhta.Net.dll
Syntax
public class DiagnosticMessageFactory
Constructors
| Improve this Doc View SourceDiagnosticMessageFactory(Int32, String)
Initializes a new instance.
Declaration
public DiagnosticMessageFactory(int messageIdBase, string messageNamespace)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | messageIdBase | Specifies a base value for the message identifiers. |
System.String | messageNamespace | Specifies a namespace for messages to create. |
DiagnosticMessageFactory(Int32, String, String, String, String)
Initializes a new instance.
Declaration
public DiagnosticMessageFactory(int messageIdBase, string informationMessageIdPrefix, string warningMessageIdPrefix, string errorMessageIdPrefix, string alertMessageIdPrefix)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | messageIdBase | Specifies a base value for the message identifiers. |
System.String | informationMessageIdPrefix | Specifies a prefix for information message identifiers. Can be null. |
System.String | warningMessageIdPrefix | Specifies a prefix for warning message identifiers. Can be null. |
System.String | errorMessageIdPrefix | Specifies a prefix for error message identifiers. Can be null. |
System.String | alertMessageIdPrefix | Specifies a prefix for alert message identifiers. Can be null. |
Remarks
Identifiers of created diagnostic messages will start from messageIdBase
+ 1 in
ascending order.
Methods
| Improve this Doc View SourceCreateAlertMessage(String)
Creates an AlertMessage instance based on a specified message.
Declaration
public AlertMessage CreateAlertMessage(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Specifies a message. The message can contain format items. |
Returns
Type | Description |
---|---|
AlertMessage | Returns the created AlertMessage instance. |
CreateAlertMessage(String, Int32)
Creates an AlertMessage instance based on a specified message.
Declaration
public AlertMessage CreateAlertMessage(string message, int messageIdOffset)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Specifies a message. The message can contain format items. |
System.Int32 | messageIdOffset | Specifies an offset that determines the message identifier to associate with the AlertMessage instance. |
Returns
Type | Description |
---|---|
AlertMessage | Returns the created AlertMessage instance. |
CreateErrorMessage(String)
Creates an ErrorMessage instance based on a specified message.
Declaration
public ErrorMessage CreateErrorMessage(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Specifies a message. The message can contain format items. |
Returns
Type | Description |
---|---|
ErrorMessage | Returns the created ErrorMessage instance. |
CreateErrorMessage(String, Int32)
Creates an ErrorMessage instance based on a specified message.
Declaration
public ErrorMessage CreateErrorMessage(string message, int messageIdOffset)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Specifies a message. The message can contain format items. |
System.Int32 | messageIdOffset | Specifies an offset that determines the message identifier to associate with the ErrorMessage instance. |
Returns
Type | Description |
---|---|
ErrorMessage | Returns the created ErrorMessage instance. |
CreateInformationMessage(String)
Creates an InformationMessage instance based on a specified message.
Declaration
public InformationMessage CreateInformationMessage(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Specifies a message. The message can contain format items. |
Returns
Type | Description |
---|---|
InformationMessage | Returns the created InformationMessage instance. |
CreateInformationMessage(String, Int32)
Creates an InformationMessage instance based on a specified message.
Declaration
public InformationMessage CreateInformationMessage(string message, int messageIdOffset)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Specifies a message. The message can contain format items. |
System.Int32 | messageIdOffset | Specifies an offset that determines the message identifier to associate with the InformationMessage instance. |
Returns
Type | Description |
---|---|
InformationMessage | Returns the created InformationMessage instance. |
CreateWarningMessage(String)
Creates a WarningMessage instance based on a specified message.
Declaration
public WarningMessage CreateWarningMessage(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Specifies a message. The message can contain format items. |
Returns
Type | Description |
---|---|
WarningMessage | Returns the created WarningMessage instance. |
CreateWarningMessage(String, Int32)
Creates a WarningMessage instance based on a specified message.
Declaration
public WarningMessage CreateWarningMessage(string message, int messageIdOffset)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Specifies a message. The message can contain format items. |
System.Int32 | messageIdOffset | Specifies an offset that determines the message identifier to associate with the WarningMessage instance. |
Returns
Type | Description |
---|---|
WarningMessage | Returns the created WarningMessage instance. |