aboutsummaryrefslogtreecommitdiff
path: root/src/lib/utils/Logger.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-05-28 20:17:31 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-05-28 20:17:31 -0400
commit6bb93ad27fbc39dc8cf6c8adb5e88e7c39e6c788 (patch)
tree84cf9b827f50803995af50394792f3ffc9f2f0cf /src/lib/utils/Logger.ts
parent6d40a6aae3e861cc15684e9f406f678099da7333 (diff)
downloadtanzanite-6bb93ad27fbc39dc8cf6c8adb5e88e7c39e6c788.tar.gz
tanzanite-6bb93ad27fbc39dc8cf6c8adb5e88e7c39e6c788.tar.bz2
tanzanite-6bb93ad27fbc39dc8cf6c8adb5e88e7c39e6c788.zip
I am dumb
Diffstat (limited to 'src/lib/utils/Logger.ts')
-rw-r--r--src/lib/utils/Logger.ts82
1 files changed, 41 insertions, 41 deletions
diff --git a/src/lib/utils/Logger.ts b/src/lib/utils/Logger.ts
index 95f32ad..b0f7da5 100644
--- a/src/lib/utils/Logger.ts
+++ b/src/lib/utils/Logger.ts
@@ -1,43 +1,43 @@
-// import { TextChannel } from 'discord.js';
-// import { BushClient } from '../extensions/BushClient';
-// import chalk from 'chalk';
+import { TextChannel } from 'discord.js';
+import { BushClient } from '../extensions/BushClient';
+import chalk from 'chalk';
-// export class Logger {
-// private client: BushClient;
-// public constructor(client: BushClient) {
-// this.client = client;
-// }
-// private stripColor(text: string): string {
-// return text.replace(
-// // eslint-disable-next-line no-control-regex
-// /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,
-// ''
-// );
-// }
-// public getChannel(channel: 'log' | 'error' | 'dm'): Promise<TextChannel> {
-// return this.client.channels.fetch(this.client.config.channels[channel]) as Promise<TextChannel>;
-// }
-// public async log(message: string, sendChannel = false): Promise<void> {
-// console.log(chalk`{bgCyan LOG} ` + message);
-// if (sendChannel) {
-// const channel = await this.getChannel('log');
-// await channel.send('[LOG] ' + this.stripColor(message));
-// }
-// }
+export class Logger {
+ private client: BushClient;
+ public constructor(client: BushClient) {
+ this.client = client;
+ }
+ private stripColor(text: string): string {
+ return text.replace(
+ // eslint-disable-next-line no-control-regex
+ /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,
+ ''
+ );
+ }
+ public getChannel(channel: 'log' | 'error' | 'dm'): Promise<TextChannel> {
+ return this.client.channels.fetch(this.client.config.channels[channel]) as Promise<TextChannel>;
+ }
+ public async log(message: string, sendChannel = false): Promise<void> {
+ console.log(chalk`{bgCyan LOG} ` + message);
+ if (sendChannel) {
+ const channel = await this.getChannel('log');
+ await channel.send('[LOG] ' + this.stripColor(message));
+ }
+ }
-// public async verbose(message: string, sendChannel = false): Promise<void> {
-// if (!this.client.config.verbose) return;
-// console.log(chalk`{bgMagenta VERBOSE} ` + message);
-// if (sendChannel) {
-// const channel = await this.getChannel('log');
-// await channel.send('[VERBOSE] ' + this.stripColor(message));
-// }
-// }
-// public async error(message: string, sendChannel = false): Promise<void> {
-// console.log(chalk`{bgRed ERROR} ` + message);
-// if (sendChannel) {
-// const channel = await this.getChannel('error');
-// await channel.send('[ERROR] ' + this.stripColor(message));
-// }
-// }
-// }
+ public async verbose(message: string, sendChannel = false): Promise<void> {
+ if (!this.client.config.verbose) return;
+ console.log(chalk`{bgMagenta VERBOSE} ` + message);
+ if (sendChannel) {
+ const channel = await this.getChannel('log');
+ await channel.send('[VERBOSE] ' + this.stripColor(message));
+ }
+ }
+ public async error(message: string, sendChannel = false): Promise<void> {
+ console.log(chalk`{bgRed ERROR} ` + message);
+ if (sendChannel) {
+ const channel = await this.getChannel('error');
+ await channel.send('[ERROR] ' + this.stripColor(message));
+ }
+ }
+}