Skip to content

Instantly share code, notes, and snippets.

@dineshr93
Created December 7, 2017 20:51
Show Gist options
  • Select an option

  • Save dineshr93/3d5f1d0760196ebfb2bc39d73b299a66 to your computer and use it in GitHub Desktop.

Select an option

Save dineshr93/3d5f1d0760196ebfb2bc39d73b299a66 to your computer and use it in GitHub Desktop.
for logging
public class Utils {
/**
* <code>getTimeStamp()</code>. This returns formated TimeStamp.
* */
private static String getTimeStamp() {
return String.format("%1$td %1$tb %1$tT.%1$tL", Calendar.getInstance());
}
/**
* <code>log(String text)</code>.This Constructor used for log w.r.t Thread
* wise.
* */
public static void log(String text) {
System.out.format("%s [%-10.8s] %s\n", getTimeStamp(), Thread
.currentThread().getName(), text);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment