I'm trying to implement my own console.log-like thing, and it's very handy to be able to do something like : console.log('something',obj) and have it print both.
I'd like to recreate this functionality, but first I must understand it.
So how does console.log do this?
I have something like this:
save : function(level, userId, message){
        //handles objects
        for(var i=2;i<arguments.length;i++){
            switch(typeof arguments[i]){
                case 'object':
                    message += ' ' + JSON.stringify(arguments[i]);
                break;
                case 'string':
                    message += arguments[i];
                break;
                case 'number':
                    message += arguments[i].toString();
                break;
            }
        }
I'm looking for all the other arguments after message and then evaluating what they are converting them, and then appending them to message.
The goal is to be able to do
logger.save('info', ,'Started app',config.env, config.port, config.etc)
 and have it handle all those objects intelligently.
 
    