Joined May 2012
·

Akapo Damilola Francis

Senior S.W.E [C & C], Partner [HXL & eChurch.ng], Founder [Zatcho!] at Cotta & Cush
·
Obafemi Awolowo University, Ile Ife.
·
·
·

@y0UngloRd remind me to almost never have to read your code. :(

@segunfamisa
Dope!!

I think this can be minimised though and made easily debuggable.
Here's what I would minimised to :

public class Logger {

private static String TAG = "APP_NAME";
private static boolean DEBUG_ON = false;

public enum LogState{
    D, I, W, E;
}

public static void log(LogState ls, String tag, String msg){
    if(DEBUG_ON){
        switch (ls){
            case D:
                Log.d(tag, msg);
                break;
            case I:
                Log.i(tag, msg);
                break;
            case W:
                Log.w(tag, msg);
                break;
            case E:
                Log.e(tag, msg);
                break;
            default:
                break;
        }
    }
}

public static void log(Class<?> cls, LogState ls, String tag, String msg){
    if(DEBUG_ON){
        switch (ls){
            case D:
                Log.d(tag, cls.getName() + " "+ msg);
                break;
            case I:
                Log.i(tag, cls.getName() + " "+ msg);
                break;
            case W:
                Log.w(tag, cls.getName() + " "+ msg);
                break;
            case E:
                Log.e(tag, cls.getName() + " "+ msg);
                break;
            default:
                break;
        }
    }
}

public static void log(Class<?> cls, LogState ls, String msg){
    if(DEBUG_ON){
        switch (ls){
            case D:
                Log.d(TAG, cls.getName() + " "+ msg);
                break;
            case I:
                Log.i(TAG, cls.getName() + " "+ msg);
                break;
            case W:
                Log.w(TAG, cls.getName() + " "+ msg);
                break;
            case E:
                Log.e(TAG, cls.getName() + " "+ msg);
                break;
            default:
                break;
        }
    }
}
}

@pmcjury Yeah. But in this particular case, there was no access to the server.

@montanaflynn Nice!! Adding it to the protip now.

@rajivperera That works. As long as the "vulnerable" doesn't echo. :)

Yeah. You should. :)

Posted to A basic ruby interview over 1 year ago

cool.

Added the credits. Apologies once again. :)

Achievements
555 Karma
83,530 Total ProTip Views