Class LogEntry
- Namespace
- Microsoft.Practices.EnterpriseLibrary.Logging
- Assembly
- Microsoft.Practices.EnterpriseLibrary.Logging.dll
Represents a log message. Contains the common properties that are required for all log messages.
public class LogEntry : ICloneable
- Inheritance
-
LogEntry
- Implements
- Derived
- Inherited Members
Constructors
LogEntry()
Initialize a new instance of a LogEntry class.
public LogEntry()
LogEntry(object, ICollection<string>, int, int, TraceEventType, string, IDictionary<string, object>)
Create a new instance of LogEntry with a full set of constructor parameters
public LogEntry(object message, ICollection<string> categories, int priority, int eventId, TraceEventType severity, string title, IDictionary<string, object> properties)
Parameters
message
objectMessage body to log. Value from ToString() method from message object.
categories
ICollection<string>Collection of category names used to route the log entry to a one or more sinks.
priority
intOnly messages must be above the minimum priority are processed.
eventId
intEvent number or identifier.
severity
TraceEventTypeLog entry severity as a Severity enumeration. (Unspecified, Information, Warning or Error).
title
stringAdditional description of the log entry message.
properties
IDictionary<string, object>Dictionary of key/value pairs to record.
LogEntry(object, string, int, int, TraceEventType, string, IDictionary<string, object>)
Create a new instance of LogEntry with a full set of constructor parameters
public LogEntry(object message, string category, int priority, int eventId, TraceEventType severity, string title, IDictionary<string, object> properties)
Parameters
message
objectMessage body to log. Value from ToString() method from message object.
category
stringCategory name used to route the log entry to a one or more trace listeners.
priority
intOnly messages must be above the minimum priority are processed.
eventId
intEvent number or identifier.
severity
TraceEventTypeLog entry severity as a Severity enumeration. (Unspecified, Information, Warning or Error).
title
stringAdditional description of the log entry message.
properties
IDictionary<string, object>Dictionary of key/value pairs to record.
Properties
ActivityId
Tracing activity id
public Guid ActivityId { get; set; }
Property Value
ActivityIdString
Tracing activity id as a string to support WMI Queries
public string ActivityIdString { get; }
Property Value
AppDomainName
The AppDomain in which the program is running
public string AppDomainName { get; set; }
Property Value
Categories
Category name used to route the log entry to a one or more trace listeners.
public ICollection<string> Categories { get; set; }
Property Value
CategoriesStrings
Category names used to route the log entry to a one or more trace listeners. This readonly property is available to support WMI queries
public string[] CategoriesStrings { get; }
Property Value
- string[]
DefaultTitle
Gets the default title for an entry.
public static string DefaultTitle { get; }
Property Value
ErrorMessages
Gets the error message with the LogEntry
public string ErrorMessages { get; }
Property Value
EventId
Event number or identifier.
public int EventId { get; set; }
Property Value
ExtendedProperties
Dictionary of key/value pairs to record.
public IDictionary<string, object> ExtendedProperties { get; set; }
Property Value
LoggedSeverity
Gets the string representation of the Severity enumeration.
public string LoggedSeverity { get; }
Property Value
MachineName
Name of the computer.
public string MachineName { get; set; }
Property Value
ManagedThreadName
The name of the .NET thread.
public string ManagedThreadName { get; set; }
Property Value
- See Also
Message
Message body to log. Value from ToString() method from message object.
public string Message { get; set; }
Property Value
Priority
Importance of the log message. Only messages whose priority is between the minimum and maximum priorities (inclusive) will be processed.
public int Priority { get; set; }
Property Value
ProcessId
The Win32 process ID for the current running process.
public string ProcessId { get; set; }
Property Value
ProcessName
The name of the current running process.
public string ProcessName { get; set; }
Property Value
RelatedActivityId
Related activity id
public Guid? RelatedActivityId { get; set; }
Property Value
- Guid?
Severity
Log entry severity as a Severity enumeration. (Unspecified, Information, Warning or Error).
public TraceEventType Severity { get; set; }
Property Value
TimeStamp
Date and time of the log entry message.
public DateTime TimeStamp { get; set; }
Property Value
TimeStampString
Read-only property that returns the timeStamp formatted using the current culture.
public string TimeStampString { get; }
Property Value
Title
Additional description of the log entry message.
public string Title { get; set; }
Property Value
Win32ThreadId
The Win32 Thread ID for the current thread.
public string Win32ThreadId { get; set; }
Property Value
Methods
AddErrorMessage(string)
Add an error or warning message to the start of the messages string builder.
public virtual void AddErrorMessage(string message)
Parameters
message
stringMessage to be added to this instance
Clone()
Creates a new LogEntry that is a copy of the current instance.
public object Clone()
Returns
- object
A new
LogEntry
that is a copy of the current instance.
Remarks
If the dictionary contained in ExtendedProperties implements ICloneable, the resulting
LogEntry will have its ExtendedProperties set by calling Clone()
. Otherwise the resulting
LogEntry will have its ExtendedProperties set to null.
GetProcessName()
Gets the current process name.
public static string GetProcessName()
Returns
- string
The process name.
ToString()
public override string ToString()