-
Notifications
You must be signed in to change notification settings - Fork 1
/
Debug.java
30 lines (24 loc) · 878 Bytes
/
Debug.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.util.Calendar;
public class Debug {
/**
* Writes a message to System.out.println in the format
* [mm/dd/yy hh:mm:ss] message.
* @param activity The message.
*/
public static void writeActivity(String activity) {
// comment this line to turn on the debug output
if (true) return;
// --- get the current date and time
Calendar cal = Calendar.getInstance();
activity = "[" + cal.get(Calendar.MONTH)
+ "/" + cal.get(Calendar.DAY_OF_MONTH)
+ "/" + cal.get(Calendar.YEAR)
+ " "
+ cal.get(Calendar.HOUR_OF_DAY)
+ ":" + cal.get(Calendar.MINUTE)
+ ":" + cal.get(Calendar.SECOND)
+ "] " + activity + "\n";
// --- display the activity
System.out.print(activity);
}
}