Skip to content

Commit 495db61

Browse files
committed
feat: Change logs
Change the console.log to client.logger.info
1 parent 608d6ea commit 495db61

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/utils/botlist.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async function botlist(client){
3030
connectBdlBot(bldapikey.bdl, client).then(r => console.log(r));
3131

3232
postertopgg.on("posted", async (stats) => {
33-
console.log("Post in Top.gg | " + stats.serverCount + " servers");
33+
client.logger.info("Post in Top.gg | " + stats.serverCount + " servers");
3434
await fetch(
3535
"https://discordbotlist.com/api/v1/bots/733728002910715977/stats",
3636
{
@@ -47,7 +47,7 @@ async function botlist(client){
4747
})
4848
}
4949
).then(async (res) => {
50-
console.log("Post en DiscordBotList | " + res.status);
50+
client.logger.info("Post en DiscordBotList | " + res.status);
5151
});
5252
});
5353

src/utils/dashboard.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ const express = require('express');
22
const app = express();
33

44
let port = process.env.PORT || 80
5-
5+
let Client
66

77
async function index(client){
8+
Client = client
89
app.get('/api/all', (req, res) => {
910
const users = {}
1011
client.users.cache.forEach(user => {
@@ -112,7 +113,7 @@ async function index(client){
112113
});
113114
}
114115
app.listen(port, () => {
115-
console.log("Server in port " + port);
116+
Client.logger.info("Server in port " + port);
116117
});
117118

118119
module.exports = {

src/utils/logger.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,24 @@ const logger = createLogger({
2121
level: 'debug',
2222
format: format.combine(
2323
format.errors({ stack: true }),
24-
format.label({ label: path.basename(process.mainModule.filename) }),
25-
format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' })
24+
format.label({ label: path.basename(require.main.filename) }),
25+
format.timestamp({ format: '(YYYY/MM/DD) HH:mm:ss' })
2626
),
2727
transports: [
2828
// Logging to console
2929
new transports.Console({
3030
format: format.combine(
3131
format.colorize(),
3232
logFormat
33-
)
33+
),
34+
handleExceptions: true
3435
}),
3536
// Logging info and up to file
3637
new transports.File({
3738
filename: path.join(__basedir, 'logs/full.log'),
3839
level: 'info',
3940
format: logFormat,
40-
options: { flags: 'w' }
41+
options: { flags: 'w' }
4142
}),
4243
// Logging only warns and errors to file
4344
new transports.File({

0 commit comments

Comments
 (0)