Decided to go for slightly simplified solution and drag that log4net
dependency with MXP for now but allow other alternatives:
using System;
using System.Collections.Generic;
using System.Text;
using log4net.Repository.Hierarchy;
using log4net;
using System.Reflection;
namespace MXP.Util
{
public class LogUtil
{
private static readonly ILog logger = LogManager.GetLogger("MXP");
public static bool LogToTrace = true;
public static bool LogToLog4Net = true;
public static bool LogToConsole = false;
public static void Debug(string message)
{
if (LogToTrace)
System.Diagnostics.Debug.WriteLine(message);
if (LogToLog4Net)
logger.Debug(message);
if (LogToConsole)
Console.WriteLine("debug: " + message);
}
public static void Info(string message)
{
if (LogToTrace)
System.Diagnostics.Trace.TraceInformation(message);
if (LogToLog4Net)
logger.Info(message);
if (LogToConsole)
Console.WriteLine("info: " + message);
}
public static void Warn(string message)
{
if (LogToTrace)
System.Diagnostics.Trace.TraceWarning("Warning: " + message);
if (LogToLog4Net)
logger.Warn(message);
if (LogToConsole)
Console.WriteLine("warn: " + message);
}
public static void Error(string message)
{
if (LogToTrace)
System.Diagnostics.Trace.TraceError(message);
if (LogToLog4Net)
logger.Error(message);
if (LogToConsole)
Console.Error.WriteLine("error: " + message);
}
}
}
_______________________________________________
Opensim-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/opensim-dev