Converted logging to use log4net.

Changed LogBase to ConsoleBase, which handles console I/O.
This is mostly an in-place conversion, so lots of refactoring can still be done.
This commit is contained in:
Jeff Ames
2008-02-05 19:44:27 +00:00
parent 7a61bcff86
commit 6ed5283bc0
173 changed files with 2175 additions and 1950 deletions

View File

@@ -38,6 +38,8 @@ namespace OpenSim.Region.Physics.Manager
/// </summary>
public class PhysicsPluginManager
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<string, IPhysicsPlugin> _PhysPlugins = new Dictionary<string, IPhysicsPlugin>();
private Dictionary<string, IMeshingPlugin> _MeshPlugins = new Dictionary<string, IMeshingPlugin>();
@@ -60,25 +62,25 @@ namespace OpenSim.Region.Physics.Manager
IMesher meshEngine = null;
if (_MeshPlugins.ContainsKey(meshEngineName))
{
MainLog.Instance.Verbose("PHYSICS", "creating meshing engine " + meshEngineName);
m_log.Info("[PHYSICS]: creating meshing engine " + meshEngineName);
meshEngine = _MeshPlugins[meshEngineName].GetMesher();
}
else
{
MainLog.Instance.Warn("PHYSICS", "couldn't find meshingEngine: {0}", meshEngineName);
m_log.Warn(String.Format("[PHYSICS]: couldn't find meshingEngine: {0}", meshEngineName));
throw new ArgumentException(String.Format("couldn't find meshingEngine: {0}", meshEngineName));
}
if (_PhysPlugins.ContainsKey(physEngineName))
{
MainLog.Instance.Verbose("PHYSICS", "creating " + physEngineName);
m_log.Info("[PHYSICS]: creating " + physEngineName);
PhysicsScene result = _PhysPlugins[physEngineName].GetScene();
result.Initialise(meshEngine);
return result;
}
else
{
MainLog.Instance.Warn("PHYSICS", "couldn't find physicsEngine: {0}", physEngineName);
m_log.Warn(String.Format("[PHYSICS]: couldn't find physicsEngine: {0}", physEngineName));
throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}", physEngineName));
}
}
@@ -89,7 +91,7 @@ namespace OpenSim.Region.Physics.Manager
IMeshingPlugin plugHard;
plugHard = new ZeroMesherPlugin();
_MeshPlugins.Add(plugHard.GetName(), plugHard);
MainLog.Instance.Verbose("PHYSICS", "Added meshing engine: " + plugHard.GetName());
m_log.Info("[PHYSICS]: Added meshing engine: " + plugHard.GetName());
// And now walk all assemblies (DLLs effectively) and see if they are home
// of a plugin that is of interest for us
@@ -120,7 +122,7 @@ namespace OpenSim.Region.Physics.Manager
(IPhysicsPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Init();
_PhysPlugins.Add(plug.GetName(), plug);
MainLog.Instance.Verbose("PHYSICS", "Added physics engine: " + plug.GetName());
m_log.Info("[PHYSICS]: Added physics engine: " + plug.GetName());
}
Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin", true);
@@ -130,7 +132,7 @@ namespace OpenSim.Region.Physics.Manager
IMeshingPlugin plug =
(IMeshingPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
_MeshPlugins.Add(plug.GetName(), plug);
MainLog.Instance.Verbose("PHYSICS", "Added meshing engine: " + plug.GetName());
m_log.Info("[PHYSICS]: Added meshing engine: " + plug.GetName());
}
physTypeInterface = null;
@@ -147,11 +149,11 @@ namespace OpenSim.Region.Physics.Manager
{
if (isWarning)
{
MainLog.Instance.Warn("PHYSICS", message);
m_log.Warn("[PHYSICS]: " + message);
}
else
{
MainLog.Instance.Verbose("PHYSICS", message);
m_log.Info("[PHYSICS]: " + message);
}
}
@@ -171,4 +173,4 @@ namespace OpenSim.Region.Physics.Manager
string GetName();
IMesher GetMesher();
}
}
}

View File

@@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System;
using Axiom.Math;
using OpenSim.Framework;
using OpenSim.Framework.Console;
@@ -35,6 +36,8 @@ namespace OpenSim.Region.Physics.Manager
public abstract class PhysicsScene
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// The only thing that should register for this event is the InnerScene
// Anything else could cause problems.
@@ -92,7 +95,7 @@ namespace OpenSim.Region.Physics.Manager
public override PhysicsActor AddAvatar(string avName, PhysicsVector position)
{
MainLog.Instance.Verbose("PHYSICS", "NullPhysicsScene : AddAvatar({0})", position);
m_log.Info(String.Format("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position));
return PhysicsActor.Null;
}
@@ -107,7 +110,7 @@ namespace OpenSim.Region.Physics.Manager
/*
public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
{
MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size);
m_log.Info(String.Format("NullPhysicsScene : AddPrim({0},{1})", position, size));
return PhysicsActor.Null;
}
*/
@@ -121,7 +124,7 @@ namespace OpenSim.Region.Physics.Manager
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
PhysicsVector size, Quaternion rotation, bool isPhysical)
{
MainLog.Instance.Verbose("PHYSICS", "NullPhysicsScene : AddPrim({0},{1})", position, size);
m_log.Info(String.Format("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size));
return PhysicsActor.Null;
}
@@ -131,20 +134,19 @@ namespace OpenSim.Region.Physics.Manager
public override float Simulate(float timeStep)
{
m_workIndicator = (m_workIndicator + 1)%10;
m_workIndicator = (m_workIndicator + 1) % 10;
//MainLog.Instance.SetStatus(m_workIndicator.ToString());
return 0f;
}
public override void GetResults()
{
MainLog.Instance.Verbose("PHYSICS", "NullPhysicsScene : GetResults()");
m_log.Info("[PHYSICS]: NullPhysicsScene : GetResults()");
}
public override void SetTerrain(float[] heightMap)
{
MainLog.Instance.Verbose("PHYSICS", "NullPhysicsScene : SetTerrain({0} items)", heightMap.Length);
m_log.Info(String.Format("[PHYSICS]: NullPhysicsScene : SetTerrain({0} items)", heightMap.Length));
}
public override void DeleteTerrain()