[HH:MM:SS] LEVEL: text
void log(String level, String text) {
int h, m, s;
s = (int) ((System.currentTimeMillis() % (1000 * 60 * 60 * 24)) / 1000);
s -= (h = s / 3600) * 3600;
s -= (m = s / 60) * 60;
System.out.printf("[%02d:%02d:%02d] %s: %s\n", h, m, s, level, text);
}
System.currentTimeMillis()
This method returns the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC(coordinated universal time).
Date date = new Date(System.currentTimeMillis());
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US);
format.setTimeZone(TimeZone.getTimeZone(ZoneId.systemDefault()));
String result = format.format(date);
System.out.println(result);
2021-06-13T19:35:35