summaryrefslogtreecommitdiff
path: root/src/routers/tmwa/middlewares
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2018-04-11 12:41:03 -0400
committergumi <git@gumi.ca>2018-04-11 12:41:03 -0400
commitac5a25d7aea0626aa0f42d6bc31399aee6e7e90f (patch)
treea891d1713a0608ca981fb59eaac657c4dacf0c50 /src/routers/tmwa/middlewares
parent5422995ae12a085e5b934a56f25c68b0752bb878 (diff)
downloadapi-ac5a25d7aea0626aa0f42d6bc31399aee6e7e90f.tar.gz
api-ac5a25d7aea0626aa0f42d6bc31399aee6e7e90f.tar.bz2
api-ac5a25d7aea0626aa0f42d6bc31399aee6e7e90f.tar.xz
api-ac5a25d7aea0626aa0f42d6bc31399aee6e7e90f.zip
make the console less verbose
Diffstat (limited to 'src/routers/tmwa/middlewares')
-rw-r--r--src/routers/tmwa/middlewares/account.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/routers/tmwa/middlewares/account.js b/src/routers/tmwa/middlewares/account.js
index e29af24..1249618 100644
--- a/src/routers/tmwa/middlewares/account.js
+++ b/src/routers/tmwa/middlewares/account.js
@@ -10,7 +10,6 @@ module.exports = exports = (req, res, next) => {
status: "error",
error: "malformed request"
});
- console.info("a malformed request was received", req.ip, req.body);
req.app.locals.rate_limiting.add(req.ip);
setTimeout(() => req.app.locals.rate_limiting.delete(req.ip), 300000);
return;
@@ -22,7 +21,7 @@ module.exports = exports = (req, res, next) => {
status: "error",
error: "couldn't reach the database"
});
- console.warn("a connection with the database couldn't be established");
+ console.warn("TMWA.account: a connection with the database couldn't be established");
return;
}
@@ -40,7 +39,6 @@ module.exports = exports = (req, res, next) => {
status: "error",
error: "already exists"
});
- console.info("a request to create an already-existent account was received", req.ip, query_params.USERNAME);
req.app.locals.rate_limiting.add(req.ip);
setTimeout(() => req.app.locals.rate_limiting.delete(req.ip), 2000);
} else {
@@ -48,13 +46,13 @@ module.exports = exports = (req, res, next) => {
status: "error",
error: "couldn't add the user"
});
- console.error("an unexpected sql error occured", err);
+ console.error("TMWA.account: an unexpected sql error occured: %s", err.code);
}
} else {
res.status(201).json({
status: "success"
});
- console.info(`an account was created: ${query_params.USERNAME}`);
+ console.info("TMWA.account: an account was created: %s [%s]", query_params.USERNAME, req.ip);
req.app.locals.rate_limiting.add(req.ip);
setTimeout(() => req.app.locals.rate_limiting.delete(req.ip), 300000);
}