aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/tests/featurebrowser/FeatureUtil.java
blob: 14743c14d1a8c860fd6e59f78a61dd59fdda269d (plain)
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
31
package com.itmill.toolkit.tests.featurebrowser;

import java.text.SimpleDateFormat;
import java.util.Date;

public class FeatureUtil {

	private static boolean statistics = false;

	public static final SimpleDateFormat format = new SimpleDateFormat(
			"yyyyMMdd HHmmss");

	public static void debug(String userIdentity, String msg) {
		if (statistics)
			System.out.println("[" + userIdentity + "] " + msg);
	}

	public static String getTimestamp() {
		if (statistics)
			try {
				return format.format(new Date());
			} catch (Exception e) {
				// ignored, should never happen
			}
		return "";
	}

	public static void setStatistics(boolean statistics) {
		FeatureUtil.statistics = statistics;
	}
}