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.Tools
Assembly: ASCOM.Tools (in ASCOM.Tools.dll) Version: 3.0.0-rc.1+86c25ce733aebb4d8b1b8a62e84770ea5e972bea
C#
public class TraceLogger : IDisposable, 
	ITraceLogger, ILogger
Inheritance
Object    TraceLogger
Implements
ILogger, ITraceLogger, 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(String, Boolean, Int32, LogLevel) Create a new TraceLogger instance with automatic naming incorporating the supplied log file type
TraceLogger(String, String, String, Boolean) Create a new TraceLogger instance with the given filename and path

Properties

Enabled Enable or disable logging to the file.
IdentifierWidth Set or return the width of the identifier field in the log message
LogFileName File name of the log file being created
LogFilePath Path to the directory in which the log file will be created
LoggingLevel Return the current log level.
RespectCrLf Set True to retain carriage return and line feed as control characters. Set false to translate these to [XX] format (default true)
UseUtcTime Set True to use UTC time, set false to use Local time (default true)

Methods

BlankLine Insert a blank line into the log file
Dispose Disposes of the TraceLogger object
Log Write a message to the log.
LogMessage Write a message to the trace log
SetMinimumLoggingLevel Set the minimum log level to display.

Extension Methods

BlankLine Create a blank line in a log
(Defined by LoggerExtensions)
IsLevelActive Determine whether the supplied ILogger instance is set at the specified log level or at a more verbose level
(Defined by LoggerExtensions)
LogDebug Log a message at debug level
(Defined by LoggerExtensions)
LogError Log a message at error level
(Defined by LoggerExtensions)
LogFatal Log a message at fatal level
(Defined by LoggerExtensions)
LogInformation Log a message at information level
(Defined by LoggerExtensions)
LogMessage Log a message in TraceLogger format if the logging device is a TraceLogger, otherwise use the ILogger.Log format
(Defined by LoggerExtensions)
LogVerbose Log a message at verbose level
(Defined by LoggerExtensions)
LogWarning Log a message at warning level
(Defined by LoggerExtensions)

Version Information

.NET Standard

Supported in: 2.0

See Also