Moved logging into separate class and fixed ZoneService bug where if the name was rejected, the character would be created anyways

This commit is contained in:
Obique
2015-05-22 01:52:44 -05:00
parent eac0e0b736
commit da183696c7
10 changed files with 230 additions and 106 deletions
-19
View File
@@ -27,9 +27,6 @@
***********************************************************************************/
package resources.control;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import network.OutboundPacketService;
import network.packets.Packet;
import resources.config.ConfigFile;
@@ -45,7 +42,6 @@ import resources.services.Config;
public class Service implements IntentReceiver {
private static final OutboundPacketService outboundPacketService = new OutboundPacketService();
private static final DateFormat LOG_FORMAT = new SimpleDateFormat("dd-mm-yy HH:mm:ss.SSS");
/**
* Initializes this service. If the service returns false on this method
@@ -164,19 +160,4 @@ public class Service implements IntentReceiver {
return DataManager.getInstance().getLocalDatabase();
}
/**
* Logs the string to the server log file, formatted to display the time,
* tag and message.
* @param tag the tag to use for the log
* @param str the format string for the log
* @param args the string format arguments, if specified
*/
public synchronized final void log(String tag, String str, Object ... args) {
if (getConfig(ConfigFile.PRIMARY).getBoolean("DEBUG-SERVICES", true)) {
String logStr = String.format(str, args);
String log = String.format("%s [%s]: %s", LOG_FORMAT.format(System.currentTimeMillis()), tag, logStr);
DataManager.getInstance().log(log);
}
}
}