SimpleLog/SimpleLog/Src/Framework/ILogHandler.cs

40 lines
1.2 KiB
C#

namespace SimpleLog.Framework {
/// <summary>
/// Interface for log handlers. Log handlers are injected
/// into ILoggers. They handle the physical act of actually
/// logging the message to the wherever that message should
/// go (e.g. file, console, output stream, nowhere, etc.).
/// </summary>
public interface ILogHandler {
/// <summary>
/// Gracefully shuts down the log handler
/// </summary>
void GracefulShutDown();
/// <summary>
/// Gets or sets the log level
/// </summary>
LogLevel LogLevel { get; set; }
/// <summary>
/// Logs a message at the specified log level
/// </summary>
/// <param name="message">The message to log</param>
/// <param name="level">The log level of the message</param>
/// <returns>TRUE if all handlers succesfully logged, or false if any of them failed</returns>
bool Log(string message, LogLevel level);
/// <summary>
/// Gets or sets the message handler
/// </summary>
IMessageHandler MessageHandler { get; set; }
/// <summary>
/// Applies a configuration to the log handler
/// </summary>
void ApplyConfig(LogHandlerConfig config);
}
}