UptoLog Satellite logging functionality
This shortly describes how to use
UptoLog Satellite
logging functionality - with code examples.
Name space
UptoLog Satellites functionality is placed in a name space which is included as follows:
using UptoLog.Satellite;
Logging an error
An error is logged by a method call. UptoLog logs errors in three different
error levels.
Depending on the wanted error level, one of the following methods is used:
LogFatalError, LogError, or LogWarning.
This shows how a fatal error is logged:
try
{
// The application code that can cause the error.
}
catch (Exception exc)
{
Log.LogFatalError(exc); // Logging fatal error.
}
Generate trace
Traces
are collected by UptoLog Satellite which sends the trace loggings in packages.
This shows how a trace is generated:
private void SomeMethod()
{
Log.LogTraceItem("Trace text before the code is executed");
// Some application code.
Log.LogTraceItem("Trace text after the code is executed");
}
Generate time measurements
UptoLog Satellite collects the
time measurements
and sends the measurements in packages.
The time measurements can generally be generated in two different ways.
This shows how time measurements are generated:
First method
private void SomeMethod()
{
TimeMeasure tm = Log.BeginTimeMeasure("Name of the time measurement");
// Some application code.
tm.EndTimeMeasure();
}
Second method
private void SomeMethod()
{
using (Log.BeginTimeMeasure("Name of the time measurement"))
{
// Some application code.
} // The time measurement is automatically stopped even thought
// the application code faults.
}
|