Added some logging
parent
36daea4480
commit
335d167ead
|
@ -25,6 +25,8 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
|
@ -32,17 +34,19 @@ using OpenSim.Framework.Servers.HttpServer;
|
|||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using OpenMetaverse;
|
||||
using Nini.Config;
|
||||
|
||||
using log4net;
|
||||
|
||||
|
||||
namespace OpenSim.Services.IntegrationService
|
||||
{
|
||||
public class IntegrationService : IntegrationServiceBase, IIntegrationService
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public IntegrationService(IConfigSource config, IHttpServer server)
|
||||
: base(config, server)
|
||||
{
|
||||
m_log.InfoFormat("[IntegrationService]: Loaded");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Services.Base;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
@ -34,6 +35,7 @@ using Nini.Config;
|
|||
using OpenSim.Framework;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using Mono.Addins;
|
||||
using log4net;
|
||||
|
||||
|
||||
[assembly:AddinRoot ("IntegrationService", "1.0")]
|
||||
|
@ -44,11 +46,14 @@ namespace OpenSim.Services.IntegrationService
|
|||
public interface IntegrationPlugin
|
||||
{
|
||||
void Init(IConfigSource config);
|
||||
string Name{ get; }
|
||||
}
|
||||
|
||||
|
||||
public class IntegrationServiceBase : ServiceBase
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected IPresenceService m_PresenceService;
|
||||
protected IGridService m_GridService;
|
||||
protected IHttpServer m_Server;
|
||||
|
@ -60,14 +65,20 @@ namespace OpenSim.Services.IntegrationService
|
|||
Object[] args = new Object[] { config };
|
||||
|
||||
|
||||
AddinManager.AddinLoaded += on_addinloaded_;
|
||||
|
||||
m_Server = server;
|
||||
|
||||
suppress_console_output_(true);
|
||||
AddinManager.Initialize (".");
|
||||
AddinManager.Registry.Update ();
|
||||
suppress_console_output_(false);
|
||||
|
||||
foreach (IntegrationPlugin cmd in AddinManager.GetExtensionObjects("/OpenSim/IntegrationService"))
|
||||
{
|
||||
cmd.Init (config);
|
||||
server.AddStreamHandler((IRequestHandler)cmd);
|
||||
m_log.InfoFormat("[Integration]: Loading IntegrationService plugin {0}", cmd.Name);
|
||||
}
|
||||
|
||||
m_IntegrationServerConfig = config.Configs["IntegrationService"];
|
||||
|
@ -87,5 +98,25 @@ namespace OpenSim.Services.IntegrationService
|
|||
m_PresenceService = LoadPlugin<IPresenceService>(presenceService, args);
|
||||
|
||||
}
|
||||
|
||||
private void on_addinloaded_(object sender, AddinEventArgs args)
|
||||
{
|
||||
m_log.Info ("[IntegrationService]: Plugin Loaded: " + args.AddinId);
|
||||
}
|
||||
|
||||
private static TextWriter prev_console_;
|
||||
public void suppress_console_output_(bool save)
|
||||
{
|
||||
if (save)
|
||||
{
|
||||
prev_console_ = System.Console.Out;
|
||||
System.Console.SetOut(new StreamWriter(Stream.Null));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (prev_console_ != null)
|
||||
System.Console.SetOut(prev_console_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1169,6 +1169,7 @@
|
|||
<Reference name="System.Xml"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
|
|
Loading…
Reference in New Issue