mirror of
https://github.com/livingcomputermuseum/IFS.git
synced 2026-01-29 21:30:54 +00:00
51 lines
1.0 KiB
C#
51 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace IFS.Logging
|
|
{
|
|
[Flags]
|
|
public enum LogLevel
|
|
{
|
|
None = 0,
|
|
Normal = 1,
|
|
Warning = 2,
|
|
Error = 4,
|
|
DroppedPacket = 8,
|
|
InvalidPacket = 0x10,
|
|
UnhandledProtocol = 0x20,
|
|
HandledProtocol = 0x40,
|
|
DuplicateHostNumber = 0x80,
|
|
BSPLostPacket = 0x100,
|
|
|
|
All = 0x7fffffff,
|
|
}
|
|
|
|
public static class Log
|
|
{
|
|
static Log()
|
|
{
|
|
_level = LogLevel.All;
|
|
}
|
|
|
|
public static LogLevel Level
|
|
{
|
|
get { return _level; }
|
|
set { _level = value; }
|
|
}
|
|
|
|
public static void Write(LogLevel level, string message)
|
|
{
|
|
if ((level & _level) != 0)
|
|
{
|
|
// My log has something to tell you...
|
|
Console.WriteLine("{0}: {1} - {2}", DateTime.Now, level, message);
|
|
}
|
|
}
|
|
|
|
private static LogLevel _level;
|
|
}
|
|
}
|