Skip to content
Snippets Groups Projects
Commit 73edd413 authored by Lucas Gabriel Lima's avatar Lucas Gabriel Lima
Browse files

replace the console.log with the application logger to log errors/warnings/info

parent ff65ca45
No related branches found
No related tags found
2 merge requests!116Release v1.0.0,!25Auth
Pipeline #
...@@ -11,7 +11,7 @@ mongoose.Promise = global.Promise; ...@@ -11,7 +11,7 @@ mongoose.Promise = global.Promise;
module.exports = () => { module.exports = () => {
// Get mongodb URI (ip and port) in config file // Get mongodb URI (ip and port) in config file
const mongoUri = process.env.MONGO_URI || config.mongodb.uri; const mongoUri = process.env.MONGO_URI || config.mongodb.uri;
log.debug(`Connecting to MongDB on URI ${mongoUri}`); log.debug(`Connecting to MongoDB on URI ${mongoUri}`);
// Connection singleton // Connection singleton
const db = mongoose.connect(mongoUri); const db = mongoose.connect(mongoUri);
......
...@@ -100,7 +100,7 @@ userApp.post('/', (req, res, next) => { ...@@ -100,7 +100,7 @@ userApp.post('/', (req, res, next) => {
}, (req, res, next) => { }, (req, res, next) => {
User.count({'email': req.body.email}, function(err, count){ User.count({'email': req.body.email}, function(err, count){
if (err){ if (err){
console.log('MongoDB error: ' + err); log.error('MongoDB error: ' + err);
res.json({success: false, msg: 'Um erro ocorreu no banco de dados.'}); res.json({success: false, msg: 'Um erro ocorreu no banco de dados.'});
} }
if(count){ if(count){
...@@ -113,7 +113,7 @@ userApp.post('/', (req, res, next) => { ...@@ -113,7 +113,7 @@ userApp.post('/', (req, res, next) => {
}, (req, res, next) => { }, (req, res, next) => {
User.count({'cpf': req.body.cpf}, function(err, count){ User.count({'cpf': req.body.cpf}, function(err, count){
if (err){ if (err){
console.log('MongoDB error: ' + err); log.error('MongoDB error: ' + err);
res.json({success: false, msg: 'Um erro ocorreu no banco de dados.'}); res.json({success: false, msg: 'Um erro ocorreu no banco de dados.'});
} }
if(count){ if(count){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment