TraceLogger Class

Creates a log file for a driver or application. Uses a similar file name and internal format to the serial logger. Multiple logs can be created simultaneously if needed.

Definition

Namespace: ASCOM.Utilities
Assembly: ASCOM.Utilities (in ASCOM.Utilities.dll) Version: 7.1.3+4851.c5da65c2b
C#
public class TraceLogger : IDisposable
Inheritance
Object    TraceLogger
Implements
IDisposable

Remarks

In automatic mode the file will be stored in an ASCOM folder within XP's My Documents folder or equivalent places in other operating systems. Within the ASCOM folder will be a folder named Logs yyyy-mm-dd where yyyy, mm and dd are today's year, month and day numbers. The trace file will appear within the day folder with the name ASCOM.Identifier.hhmm.ssffff where hh, mm, ss and ffff are the current hour, minute, second and fraction of second numbers at the time of file creation.

Within the file the format of each line is hh:mm:ss.fff Identifier Message where hh, mm, ss and fff are the hour, minute, second and fractional second at the time that the message was logged, Identifier is the supplied identifier (usually the subroutine, function, property or method from which the message is sent) and Message is the message to be logged.

Constructors

TraceLogger Creates a new TraceLogger instance
TraceLogger(String) Create and enable a new TraceLogger instance with automatic naming based on the supplied log file type
TraceLogger(String, String) Creates a new TraceLogger instance and initialises filename and type

Properties

Enabled Enables or disables logging to the file.
IdentifierWidth Set or return the width of the identifier field in the log message
LogFileName Return the full filename of the log file being created
LogFilePath Set or return the path to a directory in which the log file will be created
UnicodeEnabled Controls whether non-ASCII Unicode characters are printed or displayed as hex
UseMutexSynchronisation Enables TraceLogger's historic mutex-based synchronization mechanic (not recommended, see remarks).

Methods

BlankLine Insert a blank line into the log file
Dispose Disposes of the TraceLogger object
LogContinue(String) Appends further message to a line started by LogStart, does not terminate the line.
LogContinue(String, Boolean) Appends further message to a line started by LogStart, appends a hex translation of the message to the line, does not terminate the line.
LogFinish(String) Closes a line started by LogStart with the supplied message
LogFinish(String, Boolean) Closes a line started by LogStart with the supplied message and a hex translation of the message
LogIssue Logs an issue, closing any open line and opening a continuation line if necessary after the issue message.
LogMessage(String, String) Logs a complete message in one call
LogMessage(String, String, Boolean) Logs a complete message in one call, including a hex translation of the message
LogMessageCrLf Displays a message respecting carriage return and linefeed characters
LogStart Writes the time and identifier to the log, leaving the line ready for further content through LogContinue and LogFinish
SetLogFile Sets the log filename and type if the constructor is called without parameters

See Also