Class SessionLogger
Provides logging functionality for sessions with file output capabilities.
public class SessionLogger : IDisposable, IMakeXmlSource
- Inheritance
-
SessionLogger
- Implements
- Inherited Members
- Extension Methods
Constructors
SessionLogger()
Initializes a new instance of the SessionLogger class.
public SessionLogger()
SessionLogger(XElement)
Initializes a new instance of the SessionLogger class from an XML element.
public SessionLogger(XElement src)
Parameters
srcXElementThe XML element containing the logger configuration
Fields
XName
Gets the XML element name used for serialization.
public static string XName
Field Value
Properties
SessionPath
Gets the actual path of the current session log file.
public string SessionPath { get; }
Property Value
SessionPathFormat
Gets or sets the format string for the session log file path.
public string SessionPathFormat { get; set; }
Property Value
Methods
Add(string)
Adds a message to the session log.
public void Add(string msg)
Parameters
msgstringThe message to add to the log
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
protected virtual void Dispose(bool disposing)
Parameters
disposingbool
MakeXmlSource(string, string)
Creates an XML representation of the object. This method may also generate additional resources such as related files.
public XElement MakeXmlSource(string baseDirectory, string relFile)
Parameters
baseDirectorystringThe base directory for resolving relative paths
relFilestringThe relative file path for the XML source
Returns
- XElement
An XML element representing the object's state
Prepare()
Prepare for the performance of first call of Add(string).
public void Prepare()
Reset()
Resets the logger, closing the current log file and triggering the session end event.
public void Reset()
Events
MessageEventHandler
Event triggered when a message is added to the log.
public event EventHandler<string> MessageEventHandler
Event Type
SessionEndEventHandler
Event triggered when the session ends.
public event EventHandler SessionEndEventHandler