/********************************************************************
* log events to div#log.
* Code copied by JH from http://www.plupload.com/example_events.php
********************************************************************/
function log() {
var str = "";
plupload.each(arguments, function(arg) {
var row = "";
if (typeof(arg) != "string") {
plupload.each(arg, function(value, key) {
// Convert items in File objects to human readable form
if (arg instanceof plupload.File) {
// Convert status to human readable
switch (value) {
case plupload.QUEUED:
value = 'QUEUED';
break;
case plupload.UPLOADING:
value = 'UPLOADING';
break;
case plupload.FAILED:
value = 'FAILED';
break;
case plupload.DONE:
value = 'DONE';
break;
}
}
if (typeof(value) != "function") {
row += (row ? ',<br>' : '') + key + '=' + value;
}
});
str += row + " ";
} else {
str += arg + " ";
}
});
$('#log').append(str + "\n");
}