summaryrefslogtreecommitdiff
path: root/lib/temp.js
diff options
context:
space:
mode:
authorWu Cheng-Han2015-07-02 00:10:20 +0800
committerWu Cheng-Han2015-07-02 00:10:20 +0800
commit10c9811fc534a2738c19d8f74a447ed500b730a2 (patch)
tree8e46f99f36660d9c011d135fc6ce736733a5876b /lib/temp.js
parentf7f8c901f4bc39c3ed0a2bdfe1cbaa1ee6957999 (diff)
Jump to 0.3.1
Diffstat (limited to 'lib/temp.js')
-rw-r--r--lib/temp.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/temp.js b/lib/temp.js
index 90d9343f..b635644d 100644
--- a/lib/temp.js
+++ b/lib/temp.js
@@ -4,6 +4,7 @@ var mongoose = require('mongoose');
//core
var config = require("../config.js");
+var logger = require("./logger.js");
// create a temp model
var model = mongoose.model('temp', {
@@ -33,13 +34,13 @@ function findTemp(id, callback) {
id: id
}, function (err, temp) {
if (err) {
- console.log('find temp failed: ' + err);
+ logger.error('find temp failed: ' + err);
callback(err, null);
}
if (!err && temp) {
callback(null, temp);
} else {
- console.log('find temp failed: ' + err);
+ logger.error('find temp failed: ' + err);
callback(err, null);
};
});
@@ -53,10 +54,10 @@ function newTemp(id, data, callback) {
});
temp.save(function (err) {
if (err) {
- console.log('new temp failed: ' + err);
+ logger.error('new temp failed: ' + err);
callback(err, null);
} else {
- console.log("new temp success: " + temp.id);
+ logger.info("new temp success: " + temp.id);
callback(null, temp);
};
});
@@ -67,14 +68,14 @@ function removeTemp(id, callback) {
if(!err && temp) {
temp.remove(function(err) {
if(err) {
- console.log('remove temp failed: ' + err);
+ logger.error('remove temp failed: ' + err);
callback(err, null);
} else {
callback(null, null);
}
});
} else {
- console.log('remove temp failed: ' + err);
+ logger.error('remove temp failed: ' + err);
callback(err, null);
}
});