3.5.2 commit
This commit is contained in:
84
Logger.cs
Executable file → Normal file
84
Logger.cs
Executable file → Normal file
@@ -13,27 +13,22 @@ namespace bdf
|
||||
{
|
||||
sb.AppendFormat(format, objs);
|
||||
}
|
||||
catch (FormatException e)
|
||||
{
|
||||
Console.WriteLine("Logger: invalid parameters for formatting. {0}:{1}", e.Message);
|
||||
}
|
||||
catch (ArgumentNullException e)
|
||||
{
|
||||
Console.WriteLine("Logger: invalid parameters for formatting. {0}:{1}", e.Message);
|
||||
}
|
||||
catch (IndexOutOfRangeException e)
|
||||
{
|
||||
Console.WriteLine("Logger: invalid parameters for formatting. {0}:{1}", e.Message);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Logger: invalid parameters for formatting. {0}:{1}", e.Message, e.InnerException.Message);
|
||||
}
|
||||
if (level <= bdf.debug )
|
||||
{
|
||||
Console.WriteLine(sb.ToString());
|
||||
bdf.outfile.WriteLine(sb.ToString());
|
||||
}
|
||||
if (level <= bdf.adlvl )
|
||||
{
|
||||
bdf.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 <= bdf.debug )
|
||||
{
|
||||
Console.WriteLine(sb.ToString());
|
||||
@@ -44,40 +39,7 @@ namespace bdf
|
||||
bdf.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 <= bdf.debug )
|
||||
{
|
||||
Console.WriteLine(sb.ToString());
|
||||
bdf.outfile.WriteLine(sb.ToString());
|
||||
}
|
||||
if (level <= bdf.adlvl )
|
||||
{
|
||||
bdf.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 <= bdf.debug )
|
||||
{
|
||||
Console.WriteLine(sb.ToString());
|
||||
bdf.outfile.WriteLine(sb.ToString());
|
||||
}
|
||||
if (level <= bdf.adlvl )
|
||||
{
|
||||
bdf.adminLog.AppendLine(sb.ToString());
|
||||
}
|
||||
}
|
||||
*/
|
||||
public static void Log(string message)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -87,6 +49,26 @@ namespace bdf
|
||||
bdf.adminLog.AppendLine(sb.ToString());
|
||||
|
||||
}
|
||||
|
||||
public static void Log(string task, string format, params object[] objs)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendFormat("[{0}] ", task);
|
||||
try
|
||||
{
|
||||
sb.AppendFormat(format, objs);
|
||||
}
|
||||
catch (FormatException e)
|
||||
{
|
||||
Console.WriteLine("Logger: invalid parameters for formatting. {0}:{1}", e.Message, e.InnerException.Message);
|
||||
}
|
||||
catch (ArgumentNullException e)
|
||||
{
|
||||
Console.WriteLine("Logger: invalid parameters for formatting. {0}:{1}", e.Message, e.InnerException.Message);
|
||||
}
|
||||
bdf.reportfile.WriteLine(sb.ToString());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user