* Minor: Insert utility function to format raw xml strings into indented xml for debugging purposes

0.6.0-stable
Justin Clarke Casey 2008-05-09 15:51:02 +00:00
parent fe8f9a4b25
commit 6e2c7da018
3 changed files with 42 additions and 5 deletions

View File

@ -341,7 +341,9 @@ namespace OpenSim.Framework.Communications.Cache
public List<InventoryItemBase> HandleFetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID,
bool fetchFolders, bool fetchItems, int sortOrder)
{
//m_log.DebugFormat("[INVENTORY CACHE]: Fetching folders/items from {0} for agent {1}", folderID, agentID);
// m_log.DebugFormat(
// "[INVENTORY CACHE]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
// fetchFolders, fetchItems, folderID, agentID);
// XXX We're not handling sortOrder yet!

View File

@ -270,7 +270,8 @@ namespace OpenSim.Framework.Communications.Capabilities
response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>";
}
//m_log.DebugFormat("[AGENT INVENTORY]: Replying to CAPS fetch inventory request {0}", response);
//m_log.DebugFormat("[AGENT INVENTORY]: Replying to CAPS fetch inventory request with following xml");
//m_log.Debug(Util.GetFormattedXml(response));
return response;
}

View File

@ -36,6 +36,7 @@ using System.Runtime.Serialization.Formatters.Binary;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using libsecondlife;
using log4net;
using Nini.Config;
@ -43,6 +44,9 @@ using Nwc.XmlRpc;
namespace OpenSim.Framework
{
/// <summary>
/// Miscellaneous utility functions
/// </summary>
public class Util
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -162,6 +166,36 @@ namespace OpenSim.Framework
return file;
}
/// <summary>
/// Debug utility function to convert unbroken strings of XML into something human readable for occasional debugging purposes.
///
/// Please don't delete me even if I appear currently unused!
/// </summary>
/// <param name="rawXml"></param>
/// <returns></returns>
public static string GetFormattedXml(string rawXml)
{
XmlDocument xd = new XmlDocument();
xd.LoadXml(rawXml);
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
XmlTextWriter xtw = new XmlTextWriter(sw);
xtw.Formatting = Formatting.Indented;
try
{
xd.WriteTo(xtw);
}
finally
{
xtw.Close();
}
return sb.ToString();
}
public static bool IsEnvironmentSupported(ref string reason)
{
// Must have .NET 2.0 (Generics / libsl)