Permalink
Browse files

Added extra logging info for #10.

  • Loading branch information...
1 parent 28752af commit c3289bcf7d9ffbcc7a27ee62ff893dd52a73e8d0 @tieleman tieleman committed Oct 16, 2012
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/server.js
View
12 lib/server.js
@@ -153,19 +153,24 @@ processProbe = function(postData, response) {
if (config['ffprobe']) {
// Do probe
+ util.log("Starting probe for: " + postData);
+
probeHandler.doProbe(postData, function(error, stdout, stderr) {
if (error !== null) {
// something went wrong
response.statusCode = 500;
body['message'] = probeErrorMessage;
if (error.message) body['message'] += " " + error.message;
if (stderr) body['message'] += " " + stderr;
+ util.log("Error while probing: " + body['message']);
} else {
// everything's ok
response.statusCode = 200;
try {
+ util.log("Succesfully completed probe for: " + postData);
body['ffprobe'] = JSON.parse(stdout);
} catch(e) {
+ util.log("Error while parsing ffprobe response: " + stdout);
response.statuscode = 500;
body['message'] = probeFfprobeError;
if (stdout) body['message'] += " ffprobe output: " + stdout;
@@ -175,19 +180,20 @@ processProbe = function(postData, response) {
try {
response.end(JSON.stringify(body), 'utf8');
} catch(e) {
- util.log("Error while probing file: " + e + e.stack);
+ util.log("Error while sending probe response: " + e + e.stack);
}
});
} else {
// Return not supported
response.statusCode = 400;
body['message'] = probeNotSupportedMessage;
-
+ util.log("An attempt was made to probe a file, but ffprobe support was not configured.");
+
try {
response.end(JSON.stringify(body), 'utf8');
} catch(e) {
- util.log("Error while probing file: " + e + e.stack);
+ util.log("Error while sending probe response: " + e + e.stack);
}
}
}

0 comments on commit c3289bc

Please sign in to comment.