first real commit
This commit is contained in:
86
Logger.cs
Normal file
86
Logger.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
namespace cdrtool
|
||||
{
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
internal static class Logger
|
||||
{
|
||||
public static void Log(uint level, string format, params object[] objs)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendFormat("[{0}] ", DateTime.Now);
|
||||
sb.AppendFormat(format, objs);
|
||||
|
||||
if (level <= cdrtool.debug )
|
||||
{
|
||||
Console.WriteLine(sb.ToString());
|
||||
cdrtool.outfile.WriteLine(sb.ToString());
|
||||
}
|
||||
if (level <= cdrtool.adlvl )
|
||||
{
|
||||
cdrtool.adminLog.AppendLine(sb.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static void Log(uint level, string format, string s1, string s2)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendFormat("[{0}] ", DateTime.Now);
|
||||
sb.AppendFormat(format, s1, s2);
|
||||
|
||||
if (level <= cdrtool.debug )
|
||||
{
|
||||
Console.WriteLine(sb.ToString());
|
||||
cdrtool.outfile.WriteLine(sb.ToString());
|
||||
}
|
||||
if (level <= cdrtool.adlvl )
|
||||
{
|
||||
cdrtool.adminLog.AppendLine(sb.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static void Log(uint level, string format, string s1)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendFormat("[{0}] ", DateTime.Now);
|
||||
sb.AppendFormat(format, s1);
|
||||
|
||||
if (level <= cdrtool.debug )
|
||||
{
|
||||
Console.WriteLine(sb.ToString());
|
||||
cdrtool.outfile.WriteLine(sb.ToString());
|
||||
}
|
||||
if (level <= cdrtool.adlvl )
|
||||
{
|
||||
cdrtool.adminLog.AppendLine(sb.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static void Log(uint level, string message)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendFormat("[{0}] {1}", DateTime.Now, message);
|
||||
|
||||
if (level <= cdrtool.debug )
|
||||
{
|
||||
Console.WriteLine(sb.ToString());
|
||||
cdrtool.outfile.WriteLine(sb.ToString());
|
||||
}
|
||||
if (level <= cdrtool.adlvl )
|
||||
{
|
||||
cdrtool.adminLog.AppendLine(sb.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static void Log(string message)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendFormat("[{0}] {1}", DateTime.Now, message);
|
||||
Console.WriteLine(sb.ToString());
|
||||
cdrtool.outfile.WriteLine(sb.ToString());
|
||||
cdrtool.adminLog.AppendLine(sb.ToString());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user