Clean up debug logging

This commit is contained in:
bootstraponline
2014-03-06 12:42:58 -05:00
committed by Payman Delshad
parent 113fe5ce10
commit d70f8ac01d
5 changed files with 17 additions and 11 deletions

View File

@@ -15,14 +15,13 @@ public class TouchDown extends TouchEvent {
@Override
protected boolean executeTouchEvent() throws UiObjectNotFoundException {
Logger.debug("Performing touchDown using element? " + isElement + " x: "
+ clickX + ", y: " + clickY);
printEventDebugLine("TouchDown");
try {
final Object controller = getController();
final Method touchDown = getMethod("touchDown", controller);
return (Boolean) touchDown.invoke(controller, clickX, clickY);
} catch (final Exception e) {
Logger.debug("Problem invoking correct touchDown: " + e);
Logger.debug("Problem invoking touchDown: " + e);
return false;
}
}

View File

@@ -136,4 +136,14 @@ public abstract class TouchEvent extends CommandHandler {
method.setAccessible(true);
return method;
}
protected void printEventDebugLine(final String methodName,
final Integer... duration) {
String extra = "";
if (duration.length > 0) {
extra = ", duration: " + duration[0];
}
Logger.debug("Performing " + methodName + " using element? " + isElement
+ " x: " + clickX + ", y: " + clickY + extra);
}
}

View File

@@ -50,8 +50,7 @@ public class TouchLongClick extends TouchEvent {
duration = Integer.parseInt(paramDuration.toString());
}
Logger.debug("Performing longClick using element? " + isElement + " x: "
+ clickX + ", y: " + clickY + " with duration: " + duration);
printEventDebugLine("TouchLongClick", duration);
if (correctLongClick(clickX, clickY, duration)) {
return true;
}

View File

@@ -15,14 +15,13 @@ public class TouchMove extends TouchEvent {
@Override
protected boolean executeTouchEvent() throws UiObjectNotFoundException {
Logger.debug("Performing touchMove using element? " + isElement + " x: "
+ clickX + ", y: " + clickY);
printEventDebugLine("TouchMove");
try {
final Object controller = getController();
final Method touchMove = getMethod("touchMove", controller);
return (Boolean) touchMove.invoke(controller, clickX, clickY);
} catch (final Exception e) {
Logger.debug("Problem invoking correct touchMove: " + e);
Logger.debug("Problem invoking touchMove: " + e);
return false;
}
}

View File

@@ -15,14 +15,13 @@ public class TouchUp extends TouchEvent {
@Override
protected boolean executeTouchEvent() throws UiObjectNotFoundException {
Logger.debug("Performing touchUp using element? " + isElement + " x: "
+ clickX + ", y: " + clickY);
printEventDebugLine("TouchUp");
try {
final Object controller = getController();
final Method touchUp = getMethod("touchUp", controller);
return (Boolean) touchUp.invoke(controller, clickX, clickY);
} catch (final Exception e) {
Logger.debug("Problem invoking correct touchUp: " + e);
Logger.debug("Problem invoking touchUp: " + e);
return false;
}
}