87 lines
2.6 KiB
C#
87 lines
2.6 KiB
C#
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());
|
|
|
|
}
|
|
}
|
|
}
|
|
|