[Opensim-dev] MXPClient?
Tommi Laukkanen
tommi.s.e.laukkanen at gmail.com
Mon Feb 23 23:03:32 UTC 2009
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);
}
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20090224/2c77cb6b/attachment-0001.html>
More information about the Opensim-dev
mailing list