Guest User

Untitled

a guest
Mar 24th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. public class Log {
  2. private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(Log.class);
  3.  
  4. private String stackTrace(Exception cause) {
  5. if (cause == null)
  6. return "";
  7. StringWriter sw = new StringWriter(1024);
  8. final PrintWriter pw = new PrintWriter(sw);
  9. cause.printStackTrace(pw);
  10. pw.flush();
  11. return sw.toString();
  12. }
  13.  
  14. public void warn(Exception cause, String message) {
  15. String output = message + "\n" + stackTrace(cause);
  16. log.warn(output);
  17. }
  18.  
  19. // debug(...), info(...), etc.
  20. }
Add Comment
Please, Sign In to add comment