Skip to content

Commit

Permalink
chore(environment):change console log to debug
Browse files Browse the repository at this point in the history
Implement LFA feedback to adhere to airbnb style guide for console log statements

[Finishes #165634802]
  • Loading branch information
tolulope-od committed Apr 26, 2019
1 parent 9291d6c commit fbb4928
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import swaggerDoc from './swagger.json';
// Import route
import routes from './server/routes';

const { log } = console;
const debug = Debug('dev');

// Set up the app with express
Expand Down Expand Up @@ -38,7 +37,7 @@ app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDoc));

// Handle errors
app.use((err, req, res, next) => {
log(err.stack);
debug(err.stack);
res.status(500).json({ error: "Something broke, don't worry, it's not you, it's us" });
next();
});
Expand Down
7 changes: 4 additions & 3 deletions server/controllers/TransactionController.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import dotenv from 'dotenv';
import nodemailer from 'nodemailer';
import Debug from 'debug';
import Model from '../db';
import Mail from '../utils/Mail';
import { isEmpty } from '../validation/authValidation';
import { users } from './AuthController';

dotenv.config();
const { log } = console;

const debug = Debug('dev');
const transactions = new Model(`transactions`);
const accounts = new Model(`accounts`);

Expand Down Expand Up @@ -91,9 +92,9 @@ export default class TransactionController {
);
transporter.sendMail(emailNotif.getMailOptions(), (err, info) => {
if (err) {
log(err);
debug(err);
}
log(info);
debug(info);
});
const data = {
transactionId: newTransaction[0].transactionid,
Expand Down
11 changes: 6 additions & 5 deletions server/dummyControllers/TransactionController.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import dotenv from 'dotenv';
import nodemailer from 'nodemailer';
import Debug from 'debug';
import Transaction from '../dummyModels/Transaction';
import Mail from '../utils/Mail';
import dummyData from '../utils/dummyData';
import { isEmpty } from '../validation/authValidation';

dotenv.config();
const { log } = console;
const debug = Debug('dev');
const { transactions, accounts, users } = dummyData;

const transporter = nodemailer.createTransport({
Expand Down Expand Up @@ -71,9 +72,9 @@ export default class TransactionController {
const emailNotif = new Mail(transaction, accountOwner, accountNumber, accountToCredit);
transporter.sendMail(emailNotif.getMailOptions(), (err, info) => {
if (err) {
log(err);
debug(err);
}
log(info);
debug(info);
});
const data = {
transactionId: transaction.id,
Expand Down Expand Up @@ -151,9 +152,9 @@ export default class TransactionController {
const emailNotif = new Mail(transaction, accountOwner, accountNumber, accountToDebit);
transporter.sendMail(emailNotif.getMailOptions(), (err, info) => {
if (err) {
log(err);
debug(err);
}
log(info);
debug(info);
});
const data = {
transactionId: transaction.id,
Expand Down

0 comments on commit fbb4928

Please sign in to comment.