All commands are required to extend CommandBase, so we want to create a LogCommandBase that outputs the command name when it starts and ends based on whether the debug flag in constants in true.
Here is some sample code to print the name of the command based on the name and if debug is enabled:
if (Constants.kDebugEnabled) {
System.out.println(this.getName() + " started");
}
All commands are required to extend
CommandBase
, so we want to create aLogCommandBase
that outputs the command name when it starts and ends based on whether the debug flag in constants in true.Here is some sample code to print the name of the command based on the name and if debug is enabled: