reduce number of logs

some were just left in there from debugging and could be removed or set to logging.debug
some others could be compacted
a few errors were written to stdout instead of stderr
This commit is contained in:
jomo 2015-02-20 01:22:37 +01:00
parent c0c2a63a8b
commit 4b920d57e8
6 changed files with 9 additions and 15 deletions

View File

@ -113,8 +113,7 @@ exp.update_timestamp = function(rid, userId, hash, temp, callback) {
// this feature can be used to write both cape and skin at separate times // this feature can be used to write both cape and skin at separate times
// +callback+ contans error // +callback+ contans error
exp.save_hash = function(rid, userId, skin_hash, cape_hash, callback) { exp.save_hash = function(rid, userId, skin_hash, cape_hash, callback) {
logging.log(rid + "cache: saving hash"); logging.log(rid + "cache: saving skin:" + skin_hash + " cape:" + cape_hash);
logging.log(rid + "skin:" + skin_hash + " cape:" + cape_hash);
var time = new Date().getTime(); var time = new Date().getTime();
// store shorter null byte instead of "null" // store shorter null byte instead of "null"
skin_hash = (skin_hash === null ? "." : skin_hash); skin_hash = (skin_hash === null ? "." : skin_hash);

View File

@ -41,9 +41,9 @@ function store_skin(rid, userId, profile, details, callback) {
logging.error(rid + err2.stack); logging.error(rid + err2.stack);
callback(err2, null); callback(err2, null);
} else { } else {
logging.log(rid + "face extracted"); logging.debug(rid + "face extracted");
skins.extract_helm(rid, facepath, img, helmpath, function(err3) { skins.extract_helm(rid, facepath, img, helmpath, function(err3) {
logging.log(rid + "helm extracted"); logging.debug(rid + "helm extracted");
logging.debug(rid + helmpath); logging.debug(rid + helmpath);
callback(err3, skin_hash); callback(err3, skin_hash);
}); });
@ -82,7 +82,7 @@ function store_cape(rid, userId, profile, details, callback) {
callback(err, null); callback(err, null);
} else { } else {
skins.save_image(img, capepath, function(err) { skins.save_image(img, capepath, function(err) {
logging.log(rid + "cape saved"); logging.debug(rid + "cape saved");
callback(err, cape_hash); callback(err, cape_hash);
}); });
} }
@ -273,7 +273,6 @@ exp.get_avatar = function(rid, userId, helm, size, callback) {
// handles requests for +userId+ skins // handles requests for +userId+ skins
// callback contains error, skin hash, image buffer // callback contains error, skin hash, image buffer
exp.get_skin = function(rid, userId, callback) { exp.get_skin = function(rid, userId, callback) {
logging.log(rid + "skin request");
exp.get_image_hash(rid, userId, "skin", function(err, status, skin_hash) { exp.get_image_hash(rid, userId, "skin", function(err, status, skin_hash) {
var skinpath = __dirname + "/../" + config.skins_dir + skin_hash + ".png"; var skinpath = __dirname + "/../" + config.skins_dir + skin_hash + ".png";
fs.exists(skinpath, function(exists) { fs.exists(skinpath, function(exists) {
@ -324,7 +323,7 @@ exp.get_render = function(rid, userId, scale, helm, body, callback) {
} else { } else {
fs.writeFile(renderpath, img, "binary", function(err) { fs.writeFile(renderpath, img, "binary", function(err) {
if (err) { if (err) {
logging.log(rid + err.stack); logging.error(rid + err.stack);
} }
callback(null, 2, skin_hash, img); callback(null, 2, skin_hash, img);
}); });
@ -338,7 +337,6 @@ exp.get_render = function(rid, userId, scale, helm, body, callback) {
// handles requests for +userId+ capes // handles requests for +userId+ capes
// callback contains error, cape hash, image buffer // callback contains error, cape hash, image buffer
exp.get_cape = function(rid, userId, callback) { exp.get_cape = function(rid, userId, callback) {
logging.log(rid + "cape request");
exp.get_image_hash(rid, userId, "cape", function(err, status, cape_hash) { exp.get_image_hash(rid, userId, "cape", function(err, status, cape_hash) {
if (!cape_hash) { if (!cape_hash) {
callback(err, null, null); callback(err, null, null);

View File

@ -165,7 +165,7 @@ exp.save_texture = function(rid, tex_hash, outpath, callback) {
} else { } else {
fs.writeFile(outpath, img, "binary", function(err) { fs.writeFile(outpath, img, "binary", function(err) {
if (err) { if (err) {
logging.log(rid + "error: " + err.stack); logging.error(rid + "error: " + err.stack);
} }
callback(err, response, img); callback(err, response, img);
}); });

View File

@ -150,19 +150,16 @@ exp.draw_model = function(rid, img, scale, helm, body, callback) {
//Scale it //Scale it
scale_image(skin_ctx.getImageData(0,0,64,original_height), skin_ctx, 0, 0, scale); scale_image(skin_ctx.getImageData(0,0,64,original_height), skin_ctx, 0, 0, scale);
if (body) { if (body) {
logging.log(rid + "drawing body");
exp.draw_body(rid, skin_canvas, model_ctx, scale); exp.draw_body(rid, skin_canvas, model_ctx, scale);
} }
logging.log(rid + "drawing head");
exp.draw_head(skin_canvas, model_ctx, scale); exp.draw_head(skin_canvas, model_ctx, scale);
if (helm) { if (helm) {
logging.log(rid + "drawing helmet");
exp.draw_helmet(skin_canvas, model_ctx, scale); exp.draw_helmet(skin_canvas, model_ctx, scale);
} }
model_canvas.toBuffer(function(err, buf){ model_canvas.toBuffer(function(err, buf){
if (err) { if (err) {
logging.log(rid + "error creating buffer: " + err); logging.error(rid + "error creating buffer: " + err);
} }
callback(err, buf); callback(err, buf);
}); });

View File

@ -53,7 +53,7 @@ exp.extract_helm = function(rid, facefile, buffer, outname, callback) {
callback(err); callback(err);
}); });
} else { } else {
logging.log(rid + "helm image is the same as face image, not storing!"); logging.log(rid + "helm img == face img, not storing!");
callback(null); callback(null);
} }
}); });

View File

@ -118,7 +118,7 @@ module.exports = function(req, res) {
// we render the default skins, but not custom images // we render the default skins, but not custom images
renders.draw_model(rid, buf, scale, helm, body, function(err, def_img) { renders.draw_model(rid, buf, scale, helm, body, function(err, def_img) {
if (err) { if (err) {
logging.log(rid + "error while rendering default image: " + err); logging.error(rid + "error while rendering default image: " + err);
} }
sendimage(rid, http_status, img_status, def_img); sendimage(rid, http_status, img_status, def_img);
}); });