package io.tjeubaoit.android.mvc.util;

import android.util.Log;

/**
 * TODO: Class description here.
 *
 * @author <a href="https://github.com/tjeubaoit">tjeubaoit</a>
 */
public class Logger {

    public static Logger getLogger(Class<?> clazz) {
        return new Logger(clazz);
    }

    private final String mTag;

    private Logger(Class<?> clazz) {
        mTag = clazz.getSimpleName();
    }

    public void debug(Object msg) {
        if (msg != null) {
            Log.d(mTag, msg.toString());
        }
    }

    public void debug(Object msg, Throwable tr) {
        if (msg != null) {
            Log.d(mTag, msg.toString(), tr);
        } else {
            Log.d(mTag, "", tr);
        }
    }

    public void info(Object msg) {
        if (msg != null) {
            Log.i(mTag, msg.toString());
        }
    }

    public void info(Object msg, Throwable tr) {
        if (msg != null) {
            Log.i(mTag, msg.toString(), tr);
        } else {
            Log.i(mTag, "", tr);
        }
    }

    public void warn(Object msg) {
        if (msg != null) {
            Log.w(mTag, msg.toString());
        }
    }

    public void warn(Object msg, Throwable tr) {
        if (msg != null) {
            Log.w(mTag, msg.toString(), tr);
        } else {
            Log.w(mTag, "", tr);
        }
    }

    public void error(Object msg) {
        if (msg != null) {
            Log.e(mTag, msg.toString());
        }
    }

    public void error(Object msg, Throwable tr) {
        if (msg != null) {
            Log.e(mTag, msg.toString(), tr);
        } else {
            Log.e(mTag, "", tr);
        }
    }
}

@@ -679,32 +679,41 @@
 og.d(mTag, %22
+Exception
 %22, tr);%0A
         %7D%0A  
@@ -692,32 +692,32 @@
 xception%22, tr);%0A
-
         %7D%0A    %7D%0A
@@ -992,32 +992,41 @@
    Log.i(mTag, %22
+Exception
 %22, tr);%0A        
@@ -1309,32 +1309,41 @@
    Log.w(mTag, %22
+Exception
 %22, tr);%0A        
@@ -1603,32 +1603,32 @@
        %7D else %7B%0A
-
             Log.
@@ -1636,16 +1636,25 @@
 (mTag, %22
+Exception
 %22, tr);%0A

Update logger