Skip to content

Commit

Permalink
Logging improvements (#16)
Browse files Browse the repository at this point in the history
* Add info logger
* Log timestamp
  • Loading branch information
KevinNovak authored Nov 27, 2019
1 parent b47cd7d commit 9ecfbc8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function main() {
});

_app.listen(PORT, () => {
console.log(`App listening on port ${PORT}!`);
_logger.info(`App listening on port ${PORT}!`);
});
}

Expand Down
15 changes: 13 additions & 2 deletions services/logger.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
function error(msg) {
console.log(msg)
function info(message) {
console.log({
timestamp: Date.now(),
message
});
}

function error(error) {
console.log({
timestamp: Date.now(),
error: error.stack,
});
}

module.exports = {
info,
error
}

0 comments on commit 9ecfbc8

Please sign in to comment.