replace external httpserver by embedded one (based on same code) - This may still be very bad; clean solution and runprebuild, or clone to clan folder

This commit is contained in:
UbitUmarov
2020-04-02 21:44:34 +01:00
parent 650b051cdf
commit 67cd5efab3
54 changed files with 5669 additions and 1630 deletions

View File

@@ -0,0 +1,81 @@
using System;
using System.Diagnostics;
using System.Text;
namespace OSHttpServer
{
/// <summary>
/// Priority for log entries
/// </summary>
/// <seealso cref="ILogWriter"/>
public enum LogPrio
{
None,
/// <summary>
/// Very detailed logs to be able to follow the flow of the program.
/// </summary>
Trace,
/// <summary>
/// Logs to help debug errors in the application
/// </summary>
Debug,
/// <summary>
/// Information to be able to keep track of state changes etc.
/// </summary>
Info,
/// <summary>
/// Something did not go as we expected, but it's no problem.
/// </summary>
Warning,
/// <summary>
/// Something that should not fail failed, but we can still keep
/// on going.
/// </summary>
Error,
/// <summary>
/// Something failed, and we cannot handle it properly.
/// </summary>
Fatal
}
/// <summary>
/// Interface used to write to log files.
/// </summary>
public interface ILogWriter
{
/// <summary>
/// Write an entry to the log file.
/// </summary>
/// <param name="source">object that is writing to the log</param>
/// <param name="priority">importance of the log message</param>
/// <param name="message">the message</param>
void Write(object source, LogPrio priority, string message);
}
/// <summary>
/// Default log writer, writes everything to null (nowhere).
/// </summary>
/// <seealso cref="ILogWriter"/>
public sealed class NullLogWriter : ILogWriter
{
/// <summary>
/// The logging instance.
/// </summary>
public static readonly NullLogWriter Instance = new NullLogWriter();
/// <summary>
/// Writes everything to null
/// </summary>
/// <param name="source">object that wrote the log entry.</param>
/// <param name="prio">Importance of the log message</param>
/// <param name="message">The message.</param>
public void Write(object source, LogPrio prio, string message) {}
}
}