storage-mule
Version:
The Realtime Framework Cloud Storage Mule utility
28 lines (22 loc) • 711 B
JavaScript
//Definition of function log()
module.exports = function(opts){
var logFunction = function(){
var args = Array.prototype.slice.call(arguments);
var str = args.map(function(x) {return String(x);}).join(' ');
opts.scope.ortc.send({
applicationKey: opts.applicationKey,
privateKey: opts.privateKey,
channel: opts.debugChannel,
message: str
//message: JSON.stringify({mid:opts.muleId || '', message:str, ts: new Date().getTime()})
});
};
if(!!opts.applicationKey && !!opts.privateKey){
return logFunction;
} else {
if(opts.onException){
opts.onException('To execute the function log(), you need to initializate StorageMule with privateKey.');
}
return function() {};
}
}