Android Open Source - DIYgenomics_Android M Log






From Project

Back to project page DIYgenomics_Android.

License

The source code is released under:

/** * Copyright (C) 2010 DIYgenomics diygenomics.org * Copyright (C) 2010 Melanie Swan mxswan@gmail * Copyright (C) 2010 Michael Kolb * Copyright (C) 2010 Lawrence S. Wong * All rights reserved. * * M...

If you think the Android project DIYgenomics_Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.diygenomics.pg.utils;
//from   w  w  w  .ja  v  a 2 s  .  c  om
import java.util.HashSet;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;

public class MLog {

  static boolean globalEnabled = true;
  
  static boolean enabled = false;
  static Set<String> _map = new HashSet<String>();

  private MLog() {
  }

  public static void setGlobalEnabled(boolean f) {
    globalEnabled = f;
    if (!f) {
      Logger.getLogger("com.skyfire").setLevel(Level.OFF);
    } else {
      Logger.getLogger("com.skyfire").setLevel(Level.INFO);
    }
  }
  
  public static boolean getGlobalEnabled() {
    return globalEnabled;
  }
  
  public static void enable() {
    enabled = true;
  }

  public static void disable() {
    enabled = false;
  }

  public static void enable(String tag) {
    _map.add(tag);
  }

  public static void disable(String tag) {
    _map.remove(tag);
  }

  private static boolean isEnabled(String tag) {
    return globalEnabled && (_map.contains(tag) || enabled);
  }

  public static void setLogging(boolean f) {
    enabled = f;
  }

  public static void i(String tag, Object... vals) {
    if (isEnabled(tag)) {
      //Log.i(tag, buildString(vals));
      Logger.getLogger(tag).log(Level.INFO, buildString(vals));
    }
  }

  public static void e(String tag, Object... vals) {
    if (isEnabled(tag)) {
      //Log.e(tag, buildString(vals));
      Logger.getLogger(tag).log(Level.SEVERE, buildString(vals));
    }
  }

  private static String buildString(Object... strings) {
    StringBuilder sb = new StringBuilder();
    for (Object s : strings) {
      sb.append(s);
    }
    return sb.toString();
  }

}




Java Source Code List

android.widget.BasicExpandableList.java
android.widget.BasicListView.java
org.diygenomics.pg.CategoriesActivity.java
org.diygenomics.pg.CategoryItemActivity.java
org.diygenomics.pg.Category.java
org.diygenomics.pg.Constants.java
org.diygenomics.pg.Data.java
org.diygenomics.pg.DotUtils.java
org.diygenomics.pg.Genome.java
org.diygenomics.pg.ImportActivity.java
org.diygenomics.pg.InfoHandler.java
org.diygenomics.pg.Main.java
org.diygenomics.pg.MappingItem.java
org.diygenomics.pg.StudiesActivity.java
org.diygenomics.pg.Study.java
org.diygenomics.pg.Variant.java
org.diygenomics.pg.utils.CSVParser.java
org.diygenomics.pg.utils.ConditionVariantTableRowComparator.java
org.diygenomics.pg.utils.Flurry.java
org.diygenomics.pg.utils.MLog.java
org.diygenomics.pg.utils.Row.java