aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/tests/featurebrowser/FeatureUtil.java
blob: cf51e7756b36ff22056fbab26b0b85db496beaaa (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
32
33
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;
    }
}