DefaultLoggerService
Wisej.AI.Services.DefaultLoggerService
Namespace: Wisej.AI.Services
Assembly: Wisej.AI (3.5.0.0)
Provides a default implementation of the ILoggerService for logging messages and exceptions.
public class DefaultLoggerService : ILoggerService
This class implements the ILoggerService interface, offering methods to log messages and exceptions at various trace levels.
Constructors
DefaultLoggerService()

Initializes a new instance of DefaultLoggerService.
Methods
Log(level, context, message, arguments)

Provides functionality to log messages at various trace levels.
This method allows for logging messages with different severity levels, facilitating the tracking of information, warnings, and errors. Depending on the level specified, the method will route the message to the appropriate logging method. The supported trace levels are:
Off: No logging is performed.
Info: Logs informational messages.
Error: Logs error messages.
Warning: Logs warning messages.
Here is an example of how to use the Log method:
Log(TraceLevel.Info, "Starting process with ID {0}", processId);
Log(TraceLevel.Warning, "Disk space is low on drive {0}", driveName);
Log(TraceLevel.Error, "Failed to connect to server. Error: {0}", errorMessage);
Log(level, context, exception)

Logs an exception at a specified trace level.
This method is designed to log exceptions, allowing for a structured approach to error handling and diagnostics. The level parameter determines the severity of the log entry. Example usage of the method:
try
{
// Code that might throw an exception
}
catch (Exception ex)
{
Log(TraceLevel.Error, ex);
}
Implements
Defines a contract for logging services that support logging messages with a specified trace level and optional formatting arguments.
Last updated