You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
3.8 KiB
90 lines
3.8 KiB
namespace Common.Logging;
|
|
|
|
/// <summary>
|
|
/// Generalized interface for a logger.
|
|
/// Contains Initialization and Stopping methods, an event for when a new log entry is entered.
|
|
/// Contains various methods to create a log entry.
|
|
/// </summary>
|
|
public interface ILogger
|
|
{
|
|
/// <summary>
|
|
/// Event that is thrown whenever a new log entry was entered with any Log method.
|
|
/// </summary>
|
|
event EventHandler<NewLogEntryEventArgs>? NewLogEntry;
|
|
|
|
/// <summary>
|
|
/// Initialize the Logger once before using it.
|
|
/// Sets the minimum<see cref="Logging.LogLevel"/> to <see cref="Logging.LogLevel.Trace"/>. Therefore all log entries will be logged.
|
|
/// </summary>
|
|
void Initialize();
|
|
|
|
/// <summary>
|
|
/// Initialize the Logger once before using it.
|
|
/// </summary>
|
|
/// <param name="minimumLogLevel">log entries with a lower level than this will not be logged</param>
|
|
void Initialize(LogLevel minimumLogLevel);
|
|
|
|
/// <summary>
|
|
/// Empties queue and closes logging stream.
|
|
/// </summary>
|
|
void StopLogging();
|
|
|
|
/// <summary>
|
|
/// Changes minimum<see cref="Logging.LogLevel"/> to the given level.
|
|
/// </summary>
|
|
/// <param name="newMinimumLogLevel">log entries with a lower level than this will not be logged anymore</param>
|
|
void SetMinimumLogLevel(LogLevel newMinimumLogLevel);
|
|
|
|
#region Logging methods
|
|
/// <summary>
|
|
/// Create a Log entry with the level <see cref="Logging.LogLevel.Trace"/>.
|
|
/// </summary>
|
|
/// <param name="category">Category of the log entry. Example: Location in Software</param>
|
|
/// <param name="message">Message to describe what to log.</param>
|
|
void LogTrace(string message, string category);
|
|
|
|
/// <summary>
|
|
/// Create a Log entry with the level <see cref="Logging.LogLevel.Debug"/>.
|
|
/// </summary>
|
|
/// <param name="category">Category of the log entry. Example: Location in Software</param>
|
|
/// <param name="message">Message to describe what to log.</param>
|
|
void LogDebug(string message, string category);
|
|
|
|
/// <summary>
|
|
/// Create a Log entry with the level <see cref="Logging.LogLevel.Info"/>.
|
|
/// </summary>
|
|
/// <param name="category">Category of the log entry. Example: Location in Software</param>
|
|
/// <param name="message">Message to describe what to log.</param>
|
|
void LogInfo(string message, string category);
|
|
|
|
/// <summary>
|
|
/// Create a Log entry with the level <see cref="Logging.LogLevel.Warn"/>.
|
|
/// </summary>
|
|
/// <param name="category">Category of the log entry. Example: Location in Software</param>
|
|
/// <param name="message">Message to describe what to log.</param>
|
|
void LogWarn(string message, string category);
|
|
|
|
/// <summary>
|
|
/// Create a Log entry with the level <see cref="Logging.LogLevel.Error"/>.
|
|
/// </summary>
|
|
/// <param name="category">Category of the log entry. Example: Location in Software</param>
|
|
/// <param name="message">Message to describe what to log.</param>
|
|
void LogError(string message, string category);
|
|
|
|
/// <summary>
|
|
/// Create a Log entry with a <see cref="System.Exception"/> assigned. No message provided.
|
|
/// </summary>
|
|
/// <param name="exception">Exception associated with the log entry.</param>
|
|
/// <param name="category">Category of the log entry. Example: Location in Software</param>
|
|
void LogException(Exception exception, string category);
|
|
|
|
/// <summary>
|
|
/// Create a Log entry with a <see cref="System.Exception"/> assigned.
|
|
/// </summary>
|
|
/// <param name="exception">Exception associated with the log entry.</param>
|
|
/// <param name="message">Message to describe what to log.</param>
|
|
/// <param name="category">Category of the log entry. Example: Location in Software</param>
|
|
void LogException(Exception exception, string message, string category);
|
|
|
|
#endregion
|
|
}
|
|
|