commit
b8d3b64f07
2 changed files with 25 additions and 56 deletions
34
src/index.ts
34
src/index.ts
|
@ -17,43 +17,19 @@ const main = async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Start database manager
|
// Start database manager
|
||||||
await database()
|
await database();
|
||||||
.then(async () => {
|
|
||||||
await logger.silly("Database process started");
|
|
||||||
})
|
|
||||||
.catch(async (err) => {
|
|
||||||
await logger.error(`${err}`);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Start schedule manager
|
// Start schedule manager
|
||||||
await schedules(client)
|
await schedules(client);
|
||||||
.then(async () => {
|
|
||||||
await logger.silly("Schedules process started");
|
|
||||||
})
|
|
||||||
.catch(async (err) => {
|
|
||||||
await logger.error(`${err}`);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Start command handler
|
// Start command handler
|
||||||
await commands(client)
|
await commands(client);
|
||||||
.then(async () => {
|
|
||||||
await logger.silly("Commands process started");
|
|
||||||
})
|
|
||||||
.catch(async (err) => {
|
|
||||||
await logger.error(`${err}`);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Start event handler
|
// Start event handler
|
||||||
await events(client)
|
await events(client);
|
||||||
.then(async () => {
|
|
||||||
await logger.silly("Events process started");
|
|
||||||
})
|
|
||||||
.catch(async (err) => {
|
|
||||||
await logger.error(`${err}`);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Authorize with Discord's API
|
// Authorize with Discord's API
|
||||||
await client.login(token);
|
await client.login(token);
|
||||||
};
|
};
|
||||||
|
|
||||||
main()
|
main();
|
||||||
|
|
|
@ -3,10 +3,7 @@ import "winston-daily-rotate-file";
|
||||||
|
|
||||||
const { combine, timestamp, printf, colorize, align, json } = winston.format;
|
const { combine, timestamp, printf, colorize, align, json } = winston.format;
|
||||||
|
|
||||||
module.exports = {
|
export default winston.createLogger({
|
||||||
// Logger initialized async-hronously
|
|
||||||
logger: async () => {
|
|
||||||
return winston.createLogger({
|
|
||||||
level: process.env.LOG_LEVEL || "silly",
|
level: process.env.LOG_LEVEL || "silly",
|
||||||
transports: [
|
transports: [
|
||||||
new winston.transports.DailyRotateFile({
|
new winston.transports.DailyRotateFile({
|
||||||
|
@ -22,12 +19,8 @@ module.exports = {
|
||||||
format: "YYYY-MM-DD HH:MM:ss",
|
format: "YYYY-MM-DD HH:MM:ss",
|
||||||
}),
|
}),
|
||||||
align(),
|
align(),
|
||||||
printf(
|
printf((info) => `[${info.timestamp}] ${info.level}: ${info.message}`)
|
||||||
(info) => `[${info.timestamp}] ${info.level}: ${info.message}`
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue