Logging Classes
Generating CodeSite logging messages from an application is accomplished by
using an instance of the T|CodeSiteLogger. By default, an instance of
T|CodeSiteLogger is always available for immediate use. In VCL and VCL.NET,
the global instance named CodeSite is available. In FCL.NET, the
CodeSite static class is available.
Logging CodeSite messages simply involves calling methods of the T|CodeSiteLogger
class. The primary method used will be the overloaded Send method. In its simplest
form, a simple string message is sent. Other forms include sending numeric data types,
dates and times, objects, and much more, all without having to convert the data.
The following table highlights a few of the methods
available beyond the overloaded Send method:
| Name |
Description |
| AddCheckPoint |
Increments the check point counter and sends the value as a CodeSite CheckPoint message. |
| AddSeparator |
Sends a CodeSite Separator message to visually separate messages in the resulting log. |
| SendColor |
Sends the specified TColor as a CodeSite Color message. |
| SendCollection |
Evaluates the specified IEnumerable collection and sends its contents as a CodeSite Collection message. |
| SendControls |
Sends the Controls hierarchy for the specified control as a CodeSite Custom Hierarchy message. |
| SendDateTime |
Sends a date-time value. |
| SendError |
Sends a CodeSite Error message. |
| SendException |
Records the details of the specified Exception object and sends the data as a CodeSite Exception message. |
| SendIf |
Sends a CodeSite message only if the specified expression is true. |
| SendNote |
Sends a CodeSite Note message. |
| SendReminder |
Sends a CodeSite Reminder message. |
| SendScreenShot |
Sends an image of the specified window as a CodeSite Bitmap message. |
| SendSystemInfo |
Sends information about the user's system in a CodeSite System Information message. |
| SendTextFile |
Sends the contents of the specified text file as a CodeSite Text File message. |
| SendWarning |
Sends a CodeSite Warning message. |
| SendXmlData |
Sends the contents of the specified string as a CodeSite XML message. |
| SendXmlFile |
Sends the contents of the specified XML file as a CodeSite XML message. |
| Write |
Writes the values of the specified parameters to the appropriate row in the Viewer's ScratchPad. |
| LogEvent |
Writes the specified message string as an Information entry in the Event Log. |
| LogWarning |
Writes the specified message string as a Warning entry in the Event Log. |
| LogError |
Writes the specified message string as an Error entry in the Event Log. |
By default, the instances of T|CodeSiteLogger will instruct the Dispatcher
to direct all CodeSite messages to the CodeSite Live Viewer (i.e. live logging).
However, it is possible to redirect your CodeSite message to a different CodeSite destination.
CodeSite Destinations
There are two basic destinations for CodeSite messages: a CodeSite Live Viewer;
and a CodeSite Log File. However, these two destination types may reside either
locally or on a remote machine. Plus, CodeSite messages can be directed to multiple destinations
simultaneously.
There are several ways for the CodeSite Dispatcher to transport messages to their final
destination. The location of the viewer or log file as well as the transport details to
be used by the Dispatcher is contained in a T|CodeSiteDestination instance,
which the CodeSite Dispatcher receives from each T|CodeSiteLogger instance.
CodeSiteManager
The purpose of the CodeSiteManager is to provide properties that are
shared by all active T|CodeSiteLogger instances. For example, the CodeSiteManager
defines a DefaultDestination object. If an individual T|CodeSiteLogger does not
specify a Destination, then the DefaultDestination settings are used.
Another example is the Enabled property that can be used to prevent all
T|CodeSiteLogger insances from sending messages.
|