mirror of
https://github.com/MrTalon63/lets-go-gambling.git
synced 2026-03-09 09:17:58 +01:00
Better logging
This commit is contained in:
parent
fa77a856ca
commit
4f8ed10e34
2 changed files with 6 additions and 4 deletions
|
|
@ -28,10 +28,10 @@ class Bot extends Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async start(): Promise<void> {
|
public async start(): Promise<void> {
|
||||||
this.log.debug("Logging in with token...");
|
this.log.info("Logging in with token...");
|
||||||
this.login(process.env.TOKEN);
|
this.login(process.env.TOKEN);
|
||||||
|
|
||||||
this.log.debug("Loading commands and events...");
|
this.log.info("Loading commands...");
|
||||||
const commandFiles: string[] = await glob(`${__dirname}/commands/**/*.ts`);
|
const commandFiles: string[] = await glob(`${__dirname}/commands/**/*.ts`);
|
||||||
commandFiles.map(async (fileName: string) => {
|
commandFiles.map(async (fileName: string) => {
|
||||||
const filePath = path.resolve(fileName);
|
const filePath = path.resolve(fileName);
|
||||||
|
|
@ -40,6 +40,7 @@ class Bot extends Client {
|
||||||
if (file.aliases) file.aliases.map((alias) => this.commands.set(alias, file));
|
if (file.aliases) file.aliases.map((alias) => this.commands.set(alias, file));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.log.info("Loading events...");
|
||||||
const eventFiles: string[] = await glob(`${__dirname}/events/**/*.ts`);
|
const eventFiles: string[] = await glob(`${__dirname}/events/**/*.ts`);
|
||||||
eventFiles.map(async (fileName: string) => {
|
eventFiles.map(async (fileName: string) => {
|
||||||
const filePath = path.resolve(fileName);
|
const filePath = path.resolve(fileName);
|
||||||
|
|
@ -48,7 +49,7 @@ class Bot extends Client {
|
||||||
this.on(file.event, file.run.bind(this, this));
|
this.on(file.event, file.run.bind(this, this));
|
||||||
});
|
});
|
||||||
|
|
||||||
this.log.debug("Initialization complete!");
|
this.log.info("Initialization complete!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public getUserFromMention(mention: string): User | undefined {
|
public getUserFromMention(mention: string): User | undefined {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ let transport;
|
||||||
if (process.env.NODE_ENV === "production") {
|
if (process.env.NODE_ENV === "production") {
|
||||||
transport = pino.transport({
|
transport = pino.transport({
|
||||||
target: "pino-loki",
|
target: "pino-loki",
|
||||||
|
level: process.env.LOG_LEVEL || "info",
|
||||||
options: {
|
options: {
|
||||||
batching: true,
|
batching: true,
|
||||||
interval: 5,
|
interval: 5,
|
||||||
|
|
@ -21,9 +22,9 @@ if (process.env.NODE_ENV === "production") {
|
||||||
} else {
|
} else {
|
||||||
transport = pino.transport({
|
transport = pino.transport({
|
||||||
target: "pino-pretty",
|
target: "pino-pretty",
|
||||||
|
level: process.env.LOG_LEVEL || "info",
|
||||||
options: {
|
options: {
|
||||||
colorize: true,
|
colorize: true,
|
||||||
minimumLevel: "debug",
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue