/*
 * Karel, debug library
 *
 * Licenced under GNU GPLv2
 *
 * Author: Jonoski Pavle
 * Date: 30.04.2009
 * 
 */

util.namespace.createNamespace('KAREL.DEBUG');

KAREL.DEBUG.callConsole = function(method, m){
    if(KAREL.DEBUG.CONSOLE){
        KAREL.DEBUG.CONSOLE[method](m);
    }
};

trace = function(m){
    KAREL.DEBUG.callConsole('debug',m);
};

error = function(m){
    KAREL.DEBUG.callConsole('error',m);
};

warn = function(m){
    KAREL.DEBUG.callConsole('warn',m);
};

cprint = function(m){
    KAREL.DEBUG.callConsole('debug',m);
};

println = function(m){
    KAREL.DEBUG.callConsole('println',m);
};

info = function(m){
    KAREL.DEBUG.callConsole('info', m);
};

output = function(param){
    if(param == 'on' || param == true){
        KAREL.DEBUG.callConsole('show');
    }else if(param == 'off' || param == false){
        KAREL.DEBUG.callConsole('hide');
    }
};

debugLevel = function(l){
    KAREL.DEBUG.callConsole('setDebugLevel', l);
};
