mirror of
https://github.com/ChronosX88/FreePastry.git
synced 2024-12-04 07:12:18 +00:00
Removed DateFormatter (Swing) for Android compatibility
This commit is contained in:
parent
dfc1a063c8
commit
20b29ec381
3258
.idea/workspace.xml
3258
.idea/workspace.xml
File diff suppressed because it is too large
Load Diff
@ -40,17 +40,15 @@ advised of the possibility of such damage.
|
||||
*/
|
||||
package rice.environment.logging;
|
||||
|
||||
import java.io.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.text.DateFormatter;
|
||||
|
||||
import rice.environment.logging.simple.SimpleLogger;
|
||||
import rice.environment.params.ParameterChangeListener;
|
||||
import rice.environment.params.Parameters;
|
||||
import rice.environment.time.TimeSource;
|
||||
|
||||
import java.io.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author jstewart
|
||||
*
|
||||
@ -80,7 +78,7 @@ public abstract class AbstractLogManager implements LogManager {
|
||||
protected boolean enabled;
|
||||
protected static final PrintStream nullPrintStream = new PrintStream(new NullOutputStream());
|
||||
|
||||
public DateFormatter dateFormatter;
|
||||
public SimpleDateFormat dateFormatt;
|
||||
|
||||
public static final String SYSTEM_OUT = "System.out";
|
||||
public static final String SYSTEM_ERR = "System.err";
|
||||
@ -112,7 +110,7 @@ public abstract class AbstractLogManager implements LogManager {
|
||||
this.dateFormat = params.getString("logging_date_format");
|
||||
}
|
||||
if (this.dateFormat != null && !this.dateFormat.equals("")) {
|
||||
dateFormatter = new DateFormatter(new SimpleDateFormat(this.dateFormat));
|
||||
this.dateFormatt = new SimpleDateFormat(this.dateFormat);
|
||||
// System.out.println("DateFormat "+this.dateFormat);
|
||||
}
|
||||
|
||||
|
@ -39,15 +39,11 @@ advised of the possibility of such damage.
|
||||
*/
|
||||
package rice.environment.logging.simple;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.text.*;
|
||||
import rice.environment.logging.AbstractLogManager;
|
||||
import rice.environment.logging.HeirarchyLogger;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.swing.text.DateFormatter;
|
||||
|
||||
import rice.environment.logging.*;
|
||||
import rice.environment.time.TimeSource;
|
||||
|
||||
/**
|
||||
* This logger writes its name:time:message to the printstream provided, unless the
|
||||
* priority is lower than the minimumPriority.
|
||||
@ -70,9 +66,6 @@ public class SimpleLogger extends HeirarchyLogger {
|
||||
* Constructor.
|
||||
*
|
||||
* @param loggerName the name of this logger.
|
||||
* @param ps the stream to print to.
|
||||
* @param time the timesource.
|
||||
* @param minPriority the minimum priority to display.
|
||||
*/
|
||||
public SimpleLogger(String loggerName, AbstractLogManager alm, int level, boolean useDefault) {
|
||||
this.loggerName = loggerName;
|
||||
@ -87,13 +80,9 @@ public class SimpleLogger extends HeirarchyLogger {
|
||||
public void log(String message) {
|
||||
synchronized(alm) {
|
||||
String dateString = ""+alm.getTimeSource().currentTimeMillis();
|
||||
if (alm.dateFormatter != null) {
|
||||
try {
|
||||
Date date = new Date(alm.getTimeSource().currentTimeMillis());
|
||||
dateString = alm.dateFormatter.valueToString(date);
|
||||
} catch (ParseException pe) {
|
||||
pe.printStackTrace();
|
||||
}
|
||||
if (alm.dateFormatt != null) {
|
||||
Date date = new Date(alm.getTimeSource().currentTimeMillis());
|
||||
dateString = date.toString();
|
||||
}
|
||||
|
||||
alm.getPrintStream().println(alm.getPrefix()+":"+loggerName+":"+dateString+":"+message);
|
||||
@ -106,13 +95,9 @@ public class SimpleLogger extends HeirarchyLogger {
|
||||
public void logException(String message, Throwable exception) {
|
||||
synchronized(alm) {
|
||||
String dateString = ""+alm.getTimeSource().currentTimeMillis();
|
||||
if (alm.dateFormatter != null) {
|
||||
try {
|
||||
Date date = new Date(alm.getTimeSource().currentTimeMillis());
|
||||
dateString = alm.dateFormatter.valueToString(date);
|
||||
} catch (ParseException pe) {
|
||||
pe.printStackTrace();
|
||||
}
|
||||
if (alm.dateFormatt != null) {
|
||||
Date date = new Date(alm.getTimeSource().currentTimeMillis());
|
||||
dateString = date.toString();
|
||||
}
|
||||
|
||||
alm.getPrintStream().print(alm.getPrefix()+":"+loggerName+":"+dateString+":"+message+" ");
|
||||
|
Loading…
Reference in New Issue
Block a user