package org.jivesoftware.smack.debugger;

import java.io.Reader;
import java.io.Writer;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.jivesoftware.smack.XMPPConnection;

public class ConsoleDebugger extends AbstractDebugger {
   private final SimpleDateFormat dateFormatter = new SimpleDateFormat("hh:mm:ss aaa");

   public ConsoleDebugger(XMPPConnection connection, Writer writer, Reader reader) {
      super(connection, writer, reader);
   }

   protected void log(String logMessage) {
      String formatedDate;
      synchronized(this.dateFormatter) {
         formatedDate = this.dateFormatter.format(new Date());
      }

      System.out.println(formatedDate + ' ' + logMessage);
   }
}
