Class Message
Inheritance
System.Object
Message
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Azos.dll
Syntax
[Serializable]
[BSONSerializable("A05AEE0F-A33C-4B1D-AA45-CDEAF894A095")]
public sealed class Message : IArchiveLoggable, IBSONSerializable, IBSONDeserializable
Constructors
Message()
Creates log message defaulting from Message.DefaultHostName and UTCTime
Declaration
[SlimDeserializationCtorSkip]
public Message()
Message(Object, String, Int32)
Creates message with Parameters supplanted with caller file name and line #
Declaration
public Message(object pars, string file = null, int line = 0)
Parameters
| Type |
Name |
Description |
| System.Object |
pars |
|
| System.String |
file |
|
| System.Int32 |
line |
|
Fields
BSON_FLD_ARCHIVE_DIMENSIONS
Declaration
public const string BSON_FLD_ARCHIVE_DIMENSIONS = "arc"
Field Value
| Type |
Description |
| System.String |
|
BSON_FLD_CHANNEL
Declaration
public const string BSON_FLD_CHANNEL = "chn"
Field Value
| Type |
Description |
| System.String |
|
BSON_FLD_EXCEPTION
Declaration
public const string BSON_FLD_EXCEPTION = "ex"
Field Value
| Type |
Description |
| System.String |
|
BSON_FLD_FROM
Declaration
public const string BSON_FLD_FROM = "frm"
Field Value
| Type |
Description |
| System.String |
|
BSON_FLD_HOST
Declaration
public const string BSON_FLD_HOST = "hst"
Field Value
| Type |
Description |
| System.String |
|
BSON_FLD_PARAMETERS
Declaration
public const string BSON_FLD_PARAMETERS = "prm"
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string BSON_FLD_RELATED_TO = "rel"
Field Value
| Type |
Description |
| System.String |
|
BSON_FLD_SOURCE
Declaration
public const string BSON_FLD_SOURCE = "src"
Field Value
| Type |
Description |
| System.String |
|
BSON_FLD_TEXT
Declaration
public const string BSON_FLD_TEXT = "txt"
Field Value
| Type |
Description |
| System.String |
|
BSON_FLD_TIMESTAMP
Declaration
public const string BSON_FLD_TIMESTAMP = "uts"
Field Value
| Type |
Description |
| System.String |
|
BSON_FLD_TOPIC
Declaration
public const string BSON_FLD_TOPIC = "top"
Field Value
| Type |
Description |
| System.String |
|
BSON_FLD_TYPE
Declaration
public const string BSON_FLD_TYPE = "tp"
Field Value
| Type |
Description |
| System.String |
|
DefaultHostName
Declaration
public static string DefaultHostName
Field Value
| Type |
Description |
| System.String |
|
Properties
ArchiveDimensions
Gets/Sets archive dimension content for later retrieval of messages by key, i.e. a user ID may be used.
In most cases JSON or Laconic content is stored, the format depends on a concrete system
Declaration
public string ArchiveDimensions { get; set; }
Property Value
| Type |
Description |
| System.String |
|
Channel
Gets/Sets logical partition for messages. This property is usually used in Archive for splitting destinations
Declaration
public string Channel { get; set; }
Property Value
| Type |
Description |
| System.String |
|
Exception
Gets/Sets exception associated with message.
Set this property EVEN IF the name/text of exception is already included in Text as log sinks may elect to dump the whole stack trace
Declaration
public Exception Exception { get; set; }
Property Value
| Type |
Description |
| System.Exception |
|
From
Gets/Sets logical component ID, such as: class name, method name, process instance, that generated the message.
This field is used in the scope of Topic
Declaration
public string From { get; set; }
Property Value
| Type |
Description |
| System.String |
|
Guid
Returns global unique identifier for this particular message
Declaration
public Guid Guid { get; }
Property Value
| Type |
Description |
| System.Guid |
|
Host
Gets/Sets host name that generated the message
Declaration
public string Host { get; set; }
Property Value
| Type |
Description |
| System.String |
|
Parameters
Gets/Sets a structured parameter bag, this may be used for additional debug info like source file name, additional context etc.
Declaration
public string Parameters { get; set; }
Property Value
| Type |
Description |
| System.String |
|
Gets/Sets global unique identifier of a message that this message is related to.
No referential integrity check is performed
Declaration
public Guid RelatedTo { get; set; }
Property Value
| Type |
Description |
| System.Guid |
|
Source
Gets/Sets message source line number/tracepoint#, this is used in conjunction with From
Declaration
public int Source { get; set; }
Property Value
| Type |
Description |
| System.Int32 |
|
Text
Gets/Sets an unstructured message text, the emitting component name must be in From field, not in text.
Note about logging errors. Use caught exception.ToMessageWithType() method, then attach the caught exception as Exception property
Declaration
public string Text { get; set; }
Property Value
| Type |
Description |
| System.String |
|
Topic
Gets/Sets a message topic/relation - the name of software concern within a big system, e.g. "Database" or "Security"
Declaration
public string Topic { get; set; }
Property Value
| Type |
Description |
| System.String |
|
Type
Gets/Sets message type, such as: Info/Warning/Error etc...
Declaration
public MessageType Type { get; set; }
Property Value
UTCTimeStamp
Gets/Sets timestamp when message was generated
Declaration
public DateTime UTCTimeStamp { get; set; }
Property Value
| Type |
Description |
| System.DateTime |
|
Methods
Clone()
Declaration
Returns
DeserializeFromBSON(BSONSerializer, BSONDocument, ref Object)
Declaration
public void DeserializeFromBSON(BSONSerializer serializer, BSONDocument doc, ref object context)
Parameters
Supplants the from string with caller as JSON string
Declaration
public static object FormatCallerParams(object pars, string file = null, int line = 0)
Parameters
| Type |
Name |
Description |
| System.Object |
pars |
|
| System.String |
file |
|
| System.Int32 |
line |
|
Returns
| Type |
Description |
| System.Object |
|
IsKnownTypeForBSONDeserialization(Type)
Declaration
public bool IsKnownTypeForBSONDeserialization(Type type)
Parameters
| Type |
Name |
Description |
| System.Type |
type |
|
Returns
| Type |
Description |
| System.Boolean |
|
SerializeToBSON(BSONSerializer, BSONDocument, IBSONSerializable, ref Object)
Declaration
public void SerializeToBSON(BSONSerializer serializer, BSONDocument doc, IBSONSerializable parent, ref object context)
Parameters
SetParamsAsObject(Object)
Declaration
public Message SetParamsAsObject(object p)
Parameters
| Type |
Name |
Description |
| System.Object |
p |
|
Returns
ToString()
Declaration
public override string ToString()
Returns
| Type |
Description |
| System.String |
|
Overrides
System.Object.ToString()
Implements
Extension Methods