Termite Logging Framework for .NET termite VS Tool online logging
tweet tweet tweet tweet tweet

Logging in an Application

Sample Loggging Methods

logger.LogDebug("x = " + x);

logger.LogInfo("User " + aUser + "has visited page " + page);


logger.LogWarning("Database is inaccessible");


logger.LogCritical("Database is down");

logger.LogFatal("Application is exitting because " + reason);

Debug, Info, Status, Warning, Error, Critical, and Fatal are all severities. A logger can be set to only log items that are of a specified severity or higher, while ignoring items of lower importance.

If you prefer, you can specify the severity as a parameter such as

logger.Log( LogSeverity.Info, "This is some information" );

logger.Log( LogSeverity.Error, anException );

Using "Categories"

Categories are simply an optional way of organizing log entries. A category can be an instance of any class you wish, but most likely would simply be a String. You might like to categorize log entries based on their respective sub-system, or by their general meaning for the application.

logger.LogWarning("Database", "Database is non-responsive");
logger.Log( LogSeverity.Warning, "Database", "Database is non-responsive");