Skip to content

Commit

Permalink
Disable writing logs to file
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomah committed Oct 24, 2023
1 parent 37d0e6b commit 8e6d60c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "boothby",
"version": "2.4.0",
"version": "2.4.1",
"description": "A Slack Bot to raise awareness on a topic",
"repository": {
"type": "git",
Expand Down
10 changes: 7 additions & 3 deletions src/logger.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
const fs = require("fs");

const SAVE_LOGS = process.env.SAVE_LOGS ? process.env.SAVE_LOGS : false;

var print = function (level, message) {
message = '[' + new Date().toLocaleString("FR", { timeZone: 'Europe/Paris' }) + '][' + level + '] ' + message;
// eslint-disable-next-line no-console
console.log(message);
fs.appendFile('console.log', message + '\n', function (err) {
if (err) throw err;
});
if(SAVE_LOGS) {
fs.appendFile('console.log', message + '\n', function (err) {
if (err) throw err;
});
}
}

exports.debug = function(message) {
Expand Down

0 comments on commit 8e6d60c

Please sign in to comment.