summaryrefslogtreecommitdiff
path: root/lib/user.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/user.js')
-rw-r--r--lib/user.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/user.js b/lib/user.js
index 11064506..f89f7def 100644
--- a/lib/user.js
+++ b/lib/user.js
@@ -4,6 +4,7 @@ var mongoose = require('mongoose');
//core
var config = require("../config.js");
+var logger = require("./logger.js");
// create a user model
var model = mongoose.model('user', {
@@ -34,13 +35,13 @@ function findUser(id, callback) {
id: id
}, function (err, user) {
if (err) {
- console.log('find user failed: ' + err);
+ logger.error('find user failed: ' + err);
callback(err, null);
}
if (!err && user) {
callback(null, user);
} else {
- console.log('find user failed: ' + err);
+ logger.error('find user failed: ' + err);
callback(err, null);
};
});
@@ -54,10 +55,10 @@ function newUser(id, profile, callback) {
});
user.save(function (err) {
if (err) {
- console.log('new user failed: ' + err);
+ logger.error('new user failed: ' + err);
callback(err, null);
} else {
- console.log("new user success: " + user.id);
+ logger.info("new user success: " + user.id);
callback(null, user);
};
});
@@ -68,7 +69,7 @@ function findOrNewUser(id, profile, callback) {
if(err || !user) {
newUser(id, profile, function(err, user) {
if(err) {
- console.log('find or new user failed: ' + err);
+ logger.error('find or new user failed: ' + err);
callback(err, null);
} else {
callback(null, user);