All Downloads are FREE. Search and download functionalities are using the official Maven repository.

syncloud.google.docs.model.Debug Maven / Gradle / Ivy

The newest version!
package syncloud.google.docs.model;

import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;

public class Debug {
  public static final boolean ENABLED = true;

  public static void enableLogging() {
    if (ENABLED) {
      Logger logger = Logger.getLogger("com.google.api.client");
      logger.setLevel(Level.FINEST);
      logger.addHandler(new Handler() {

        @Override
        public void close() throws SecurityException {
        }

        @Override
        public void flush() {
        }

        @Override
        public void publish(LogRecord record) {
          // default ConsoleHandler will take care of >= INFO
          if (record.getLevel().intValue() < Level.INFO.intValue()) {
            System.out.println(record.getMessage());
          }
        }
      });
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy