package com.cooler.util;

import android.util.Log;

/**
 * Log custom utils, we can close or open log with debug flag.
 * 
 * @author Vincent Cheung
 * @since  Nov. 20, 2014
 */
public class Logx {
	/* set in application, the default is true */
	private static boolean sDebug = false;
	/* the default tag for log */
	private static String sTag = Logx.class.getSimpleName();

	/**
	 * Set debug, output log or not.
	 * 
	 * @param debug debug flag
	 */
	public static void setDebug(boolean debug) {
		sDebug = debug;
	}
	
	/**
	 * Set log tag.
	 * 
	 * @param tag log tag
	 */
	public static void setTag(String tag) {
		sTag = tag;
	}
	
	/**
	 * Output verbose logs.
	 * 
	 * @see {@link android.util.Log#v}
	 */
	public static void v(String tag, String msg) {
		if (sDebug)
			Log.v(tag, msg);
	}
	
	/**
	 * Output debug logs.
	 * 
	 * @see {@link android.util.Log#d}
	 */
	public static void d(String tag, String msg) {
		if (sDebug)
			Log.d(tag, msg);
	}
	
	/**
	 * Output information logs.
	 * 
	 * @see {@link android.util.Log#i}
	 */
	public static void i(String tag, String msg) {
		if (sDebug)
			Log.i(tag, msg);
	}
	
	/**
	 * Output warning logs.
	 * 
	 * @see {@link android.util.Log#w}
	 */
	public static void w(String tag, String msg) {
		if (sDebug)
			Log.w(tag, msg);
	}

	/**
	 * Output error logs.
	 * 
	 * @see {@link android.util.Log#e}
	 */
	public static void e(String tag, String msg) {
		if (sDebug)
			Log.e(tag, msg);
	}
	
	/**
	 * Output verbose logs.
	 * 
	 * @see {@link #v}
	 */
	public static void v(String msg) {
		v(sTag, msg);
	}
	
	/**
	 * Output debug logs.
	 * 
	 * @see {@link #d}
	 */
	public static void d(String msg) {
		d(sTag, msg);
	}
	
	/**
	 * Output information logs.
	 * 
	 * @see {@link #i}
	 */
	public static void i(String msg) {
		i(sTag, msg);
	}
	
	/**
	 * Output warning logs.
	 * 
	 * @see {@link #w}
	 */
	public static void w(String msg) {
		w(sTag, msg);
	}

	/**
	 * Output error logs.
	 * 
	 * @see {@link #e}
	 */
	public static void e(String msg) {
		e(sTag, msg);
	}

	/**
	 * Output verbose logs.
	 * 
	 * @see {@link #v}
	 */
	public static void v(Class<?> clazz, String msg) {
		v(clazz.getName(), msg);
	}
	
	/**
	 * Output debug logs.
	 * 
	 * @see {@link #d}
	 */
	public static void d(Class<?> clazz, String msg) {
		d(clazz.getName(), msg);
	}
	
	/**
	 * Output information logs.
	 * 
	 * @see {@link #i}
	 */
	public static void i(Class<?> clazz, String msg) {
		i(clazz.getName(), msg);
	}
	
	/**
	 * Output warning logs.
	 * 
	 * @see {@link #w}
	 */
	public static void w(Class<?> clazz, String msg) {
		w(clazz.getName(), msg);
	}
	
	/**
	 * Output error logs.
	 * 
	 * @see {@link #e}
	 */
	public static void e(Class<?> clazz, String msg) {
		e(clazz.getName(), msg);
	}
}
@@ -665,39 +665,32 @@
 .%0A%09 * %0A%09 * @see 
-%7B@link 
 android.util.Log
@@ -691,17 +691,16 @@
 il.Log#v
-%7D
 %0A%09 */%0A%09p
@@ -818,39 +818,32 @@
 .%0A%09 * %0A%09 * @see 
-%7B@link 
 android.util.Log
@@ -844,17 +844,16 @@
 il.Log#d
-%7D
 %0A%09 */%0A%09p
@@ -977,39 +977,32 @@
 .%0A%09 * %0A%09 * @see 
-%7B@link 
 android.util.Log
@@ -1003,17 +1003,16 @@
 il.Log#i
-%7D
 %0A%09 */%0A%09p
@@ -1132,39 +1132,32 @@
 .%0A%09 * %0A%09 * @see 
-%7B@link 
 android.util.Log
@@ -1158,17 +1158,16 @@
 il.Log#w
-%7D
 %0A%09 */%0A%09p
@@ -1273,33 +1273,32 @@
  error logs.%0A%09 *
- 
 %0A%09 * @see %7B@link
@@ -1291,23 +1291,16 @@
  * @see 
-%7B@link 
 android.
@@ -1309,17 +1309,16 @@
 il.Log#e
-%7D
 %0A%09 */%0A%09p
@@ -1442,34 +1442,26 @@
 * %0A%09 * @see 
-%7B@link 
 #v
-%7D
 %0A%09 */%0A%09publi
@@ -1549,34 +1549,26 @@
 * %0A%09 * @see 
-%7B@link 
 #d
-%7D
 %0A%09 */%0A%09publi
@@ -1662,34 +1662,26 @@
 * %0A%09 * @see 
-%7B@link 
 #i
-%7D
 %0A%09 */%0A%09publi
@@ -1771,34 +1771,26 @@
 * %0A%09 * @see 
-%7B@link 
 #w
-%7D
 %0A%09 */%0A%09publi
@@ -1877,34 +1877,26 @@
 * %0A%09 * @see 
-%7B@link 
 #e
-%7D
 %0A%09 */%0A%09publi
@@ -1993,18 +1993,10 @@
 see 
-%7B@link 
 #v
-%7D
 %0A%09 *
@@ -2127,18 +2127,10 @@
 see 
-%7B@link 
 #d
-%7D
 %0A%09 *
@@ -2267,18 +2267,10 @@
 see 
-%7B@link 
 #i
-%7D
 %0A%09 *
@@ -2403,18 +2403,10 @@
 see 
-%7B@link 
 #w
-%7D
 %0A%09 *
@@ -2537,18 +2537,10 @@
 see 
-%7B@link 
 #e
-%7D
 %0A%09 *

update comment in Logx