Allow an avatar to be explicitly named to the "debug packet" command

remove-scene-viewer
Justin Clark-Casey (justincc) 2011-10-17 20:58:23 +01:00
parent 120114e96b
commit aeb4ff0274
2 changed files with 11 additions and 6 deletions

View File

@ -216,14 +216,15 @@ namespace OpenSim
HandleForceUpdate); HandleForceUpdate);
m_console.Commands.AddCommand("region", false, "debug packet", m_console.Commands.AddCommand("region", false, "debug packet",
"debug packet <level>", "debug packet <level> [<avatar-first-name> <avatar-last-name>]",
"Turn on packet debugging", "Turn on packet debugging",
"If level > 255 then all incoming and outgoing packets are logged.\n" "If level > 255 then all incoming and outgoing packets are logged.\n"
+ "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n" + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n"
+ "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n" + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n"
+ "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n" + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n"
+ "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n" + "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n"
+ "If level <= 0 then no packets are logged.", + "If level <= 0 then no packets are logged.\n"
+ "If an avatar name is given then only packets from that avatar are logged",
Debug); Debug);
m_console.Commands.AddCommand("region", false, "debug scene", m_console.Commands.AddCommand("region", false, "debug scene",
@ -845,18 +846,21 @@ namespace OpenSim
switch (args[1]) switch (args[1])
{ {
case "packet": case "packet":
string name = null;
if (args.Length == 5)
name = string.Format("{0} {1}", args[3], args[4]);
if (args.Length > 2) if (args.Length > 2)
{ {
int newDebug; int newDebug;
if (int.TryParse(args[2], out newDebug)) if (int.TryParse(args[2], out newDebug))
{ {
m_sceneManager.SetDebugPacketLevelOnCurrentScene(newDebug); m_sceneManager.SetDebugPacketLevelOnCurrentScene(newDebug, name);
} }
else else
{ {
MainConsole.Instance.Output("packet debug should be 0..255"); MainConsole.Instance.Output("packet debug should be 0..255");
} }
MainConsole.Instance.Output(String.Format("New packet debug: {0}", newDebug));
} }
break; break;

View File

@ -452,14 +452,15 @@ namespace OpenSim.Region.Framework.Scenes
/// console. /// console.
/// </summary> /// </summary>
/// <param name="newDebug"></param> /// <param name="newDebug"></param>
public void SetDebugPacketLevelOnCurrentScene(int newDebug) /// <param name="name">Name of avatar to debug</param>
public void SetDebugPacketLevelOnCurrentScene(int newDebug, string name)
{ {
ForEachCurrentScene( ForEachCurrentScene(
delegate(Scene scene) delegate(Scene scene)
{ {
scene.ForEachScenePresence(delegate(ScenePresence scenePresence) scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
{ {
if (!scenePresence.IsChildAgent) if (!scenePresence.IsChildAgent && (name == null || scenePresence.Name == name))
{ {
m_log.DebugFormat("Packet debug for {0} {1} set to {2}", m_log.DebugFormat("Packet debug for {0} {1} set to {2}",
scenePresence.Firstname, scenePresence.Firstname,