using System;
namespace Best.HTTP.Shared.Logger
{
[HideFromDocumentation]
public sealed class HideFromDocumentation : Attribute
{
}
///
/// Available logging levels.
///
public enum Loglevels : int
{
///
/// All message will be logged.
///
All,
///
/// Only Informations and above will be logged.
///
Information,
///
/// Only Warnings and above will be logged.
///
Warning,
///
/// Only Errors and above will be logged.
///
Error,
///
/// Only Exceptions will be logged.
///
Exception,
///
/// No logging will occur.
///
None
}
///
/// Represents an output target for log messages.
///
///
///
/// This interface defines methods for writing log messages to an output target.
/// Implementations of this interface are used to configure where log messages
/// should be written.
///
///
/// Two of its out-of-the-box implementations are
///
/// - UnityOutput
/// - FileOutput
///
///
///
public interface ILogOutput : IDisposable
{
///
/// Gets a value indicating whether the log output supports colored text.
///
bool AcceptColor { get; }
///
/// Writes a log entry to the output.
///
/// The logging level of the entry.
/// The log message to write.
void Write(Loglevels level, string logEntry);
///
/// Flushes any buffered log entries to the output.
///
void Flush();
}
///
/// Represents a filter for further sort out what log entries to include in the final log output.
///
public interface IFilter
{
///
/// Return true if the division must be included in the output.
///
bool Include(string division);
}
///
/// Represents a logger for recording log messages.
///
public interface ILogger
{
///
/// Gets or sets the minimum severity level for logging.
///
Loglevels Level { get; set; }
///
/// Gets or sets the output target for log messages.
///
///
/// The instance used to write log messages.
///
ILogOutput Output { get; set; }
///
/// Gets or sets an output filter to decide what messages are included or not.
///
/// The instance used for filtering.
IFilter Filter { get; set; }
///
/// Property indicating whether the logger's internal queue is empty or not.
///
bool IsEmpty { get; }
///
/// Gets a value indicating whether diagnostic logging is enabled.
///
///
/// Diagnostic logging is enabled when is set to .
///
bool IsDiagnostic { get; }
///
/// Logs a message with level.
///
/// The division or category of the log message.
/// The verbose log message.
/// The optional for additional context.
void Verbose(string division, string msg, LoggingContext context = null);
///
/// Logs a message with level.
///
/// The division or category of the log message.
/// The verbose log message.
/// The optional for additional context.
void Information(string division, string msg, LoggingContext context = null);
///
/// Logs a message with level.
///
/// The division or category of the log message.
/// The verbose log message.
/// The optional for additional context.
void Warning(string division, string msg, LoggingContext context = null);
///
/// Logs a message with level.
///
/// The division or category of the log message.
/// The verbose log message.
/// The optional for additional context.
void Error(string division, string msg, LoggingContext context = null);
///
/// Logs a message with level.
///
/// The division or category of the log message.
/// The verbose log message.
/// The optional for additional context.
void Exception(string division, string msg, Exception ex, LoggingContext context = null);
}
}