Implementing basic DNS Client
This commit is contained in:
50
SMTPServer/Logging/Logging.cs
Normal file
50
SMTPServer/Logging/Logging.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using System;
|
||||
|
||||
namespace Logging
|
||||
{
|
||||
public class Logging
|
||||
{
|
||||
private static LoggingType[] _ActiveLoggingTypes { get; set; }
|
||||
|
||||
public enum LoggingType
|
||||
{
|
||||
TRACE,
|
||||
ERROR,
|
||||
DEBUG,
|
||||
WARNING,
|
||||
INFO,
|
||||
ALL
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void AddLogMessage(LoggingType messagetype, string message)
|
||||
{
|
||||
if(CheckLoggingType(messagetype)) PrintToConsole(messagetype, message);
|
||||
}
|
||||
|
||||
private static bool CheckLoggingType(LoggingType lt){
|
||||
if (_ActiveLoggingTypes.Length < 1) {
|
||||
_ActiveLoggingTypes = new LoggingType[1];
|
||||
_ActiveLoggingTypes[0] = LoggingType.ALL;
|
||||
}
|
||||
bool found = false;
|
||||
foreach(LoggingType l in _ActiveLoggingTypes)
|
||||
{
|
||||
if (l == lt || l == LoggingType.ALL)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
private static void PrintToConsole(LoggingType lt, string message)
|
||||
{
|
||||
Console.WriteLine("[" + lt.ToString() + "]" + message);
|
||||
}
|
||||
}
|
||||
}
|
23
SMTPServer/Logging/Logging.csproj
Normal file
23
SMTPServer/Logging/Logging.csproj
Normal file
@ -0,0 +1,23 @@
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<NoWarn>1701;1702;1705;1006</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard1.4</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="**\*.cs" />
|
||||
<EmbeddedResource Include="**\*.resx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NETStandard.Library">
|
||||
<Version>1.6</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NET.Sdk">
|
||||
<Version>1.0.0-alpha-20161104-2</Version>
|
||||
<PrivateAssets>All</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
Reference in New Issue
Block a user