Skip to content

Commit c022ac6

Browse files
authored
Update logger (#264)
* Update logger * Refactor Logging * Fix missed errors * Fix eslint
1 parent 3122ad3 commit c022ac6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+91
-97
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
"prefer-const": ["warn", { "destructuring": "all" }],
2222
"no-constant-condition": ["error", { "checkLoops": false }],
2323
"import/extensions": ["warn", "always", { "ts": "never" }],
24-
"no-throw-literal": "error"
24+
"no-throw-literal": "error",
2525
}
2626
}

API/stats/bestiary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function getBestiary(userProfile) {
7272
maxMilestone: totalTiers / 10
7373
};
7474
} catch (error) {
75-
console.log(error);
75+
console.error(error);
7676
return null;
7777
}
7878
}

API/stats/chocolateFactory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = (profile) => {
1818
level: profile.events?.easter?.chocolate_level || 0
1919
};
2020
} catch (error) {
21-
console.log(error);
21+
console.error(error);
2222
return null;
2323
}
2424
};

API/stats/crimson.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// CREDITS: by @Kathund (https://github.com/Kathund)
2-
32
const { titleCase } = require("../constants/functions.js");
43

54
module.exports = (profile) => {
@@ -62,7 +61,7 @@ module.exports = (profile) => {
6261
trophyFishing: getTrophyFish(profile)
6362
};
6463
} catch (error) {
65-
console.log(error);
64+
console.error(error);
6665
return null;
6766
}
6867
};

API/stats/dungeons.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ module.exports = (profile) => {
9595
}
9696
};
9797
} catch (error) {
98-
console.log(error);
98+
console.error(error);
9999
return null;
100100
}
101101
};

API/stats/hotm.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module.exports = (profile) => {
3434
forgeItem.timeFinishedText =
3535
timeFinished < Date.now() ? "Finished" : `ending ${moment(timeFinished).fromNow()}`;
3636
} else {
37-
console.log(item);
37+
console.error(item);
3838
forgeItem.name = "Unknown Item";
3939
forgeItem.id = `UNKNOWN-${item.id}`;
4040
}
@@ -66,7 +66,7 @@ module.exports = (profile) => {
6666
forge: forgeItems
6767
};
6868
} catch (error) {
69-
console.log(error);
69+
console.error(error);
7070
return null;
7171
}
7272
};

API/stats/talismans.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ module.exports = async (profile) => {
7575
return null;
7676
}
7777
} catch (error) {
78-
console.log(error);
78+
console.error(error);
7979
return null;
8080
}
8181
};

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-console */
12
process.on("uncaughtException", (error) => console.log(error));
23
const app = require("./src/Application.js");
34

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
"scripts": {
77
"start": "node index.js",
88
"test": "jest --detectOpenHandles --forceExit",
9-
"lint": "npx eslint .",
10-
"lint:fix": "npx eslint . --fix",
11-
"prettier": "npx prettier --check .",
12-
"prettier:fix": "npx prettier --write .",
9+
"lint": "npx eslint src/",
10+
"lint:fix": "npx eslint src/ --fix",
11+
"prettier": "npx prettier src/ --check",
12+
"prettier:fix": "npx prettier src/ --write",
1313
"nodemon": "nodemon index"
1414
},
1515
"repository": {

src/Application.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Application {
77
constructor() {
88
require("./Configuration.js");
99
require("./Updater.js");
10+
require("./Logger.js");
1011
if (!existsSync("./data/")) mkdirSync("./data/", { recursive: true });
1112
if (!existsSync("./data/linked.json")) writeFileSync("./data/linked.json", JSON.stringify({}));
1213
}

0 commit comments

Comments
 (0)