Logging Update
- Changed to uniform logging with the 'debug' module - Updated all apps
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { readFileSync } from 'fs';
|
||||
// Debug
|
||||
import debugBuilder from "./debugBuilder.js";
|
||||
const log = new debugBuilder("bot", "configHandler");
|
||||
import ModuleDebugBuilder from "./moduleDebugBuilder.js";
|
||||
const log = new ModuleDebugBuilder("bot", "configHandler");
|
||||
|
||||
export function getConfig() {
|
||||
return JSON.parse(readFileSync("./config/botConfig.json"));
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
// Debug
|
||||
import Debug from 'debug';
|
||||
|
||||
export default class debugBuilder {
|
||||
/**
|
||||
* Create the different logging methods for a function
|
||||
* Namespace template = ("[app]:[fileName]:['INFO', 'WARNING', 'DEBUG', 'ERROR']")
|
||||
* @param {string} appName The name of the app to be used in the 'app' portion of the namespace
|
||||
* @param {string} fileName The name of the file calling the builder to be used in the 'fileName' portion of the namespace
|
||||
*/
|
||||
constructor(appName, fileName) {
|
||||
this.INFO = Debug(`${appName}:${fileName}:INFO`);
|
||||
this.DEBUG = Debug(`${appName}:${fileName}:DEBUG`);
|
||||
this.WARN = Debug(`${appName}:${fileName}:WARNING`);
|
||||
this.ERROR = Debug(`${appName}:${fileName}::ERROR`);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// Debug
|
||||
import debugBuilder from "./debugBuilder.js";
|
||||
const log = new debugBuilder("bot", "messageHandler");
|
||||
import ModuleDebugBuilder from "./moduleDebugBuilder.js";
|
||||
const log = new ModuleDebugBuilder("bot", "messageHandler");
|
||||
|
||||
export function replyToInteraction(interaction, message){
|
||||
interaction.reply({ content: message, fetchReply: true })
|
||||
|
||||
17
Client/discord-bot/utilities/moduleDebugBuilder.js
Normal file
17
Client/discord-bot/utilities/moduleDebugBuilder.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// Debug
|
||||
import Debug from 'debug';
|
||||
|
||||
/**
|
||||
* Create the different logging methods for a function
|
||||
* Namespace template = ("[app]:[fileName]:['INFO', 'WARNING', 'DEBUG', 'ERROR']")
|
||||
* @param {string} appName The name of the app to be used in the 'app' portion of the namespace
|
||||
* @param {string} fileName The name of the file calling the builder to be used in the 'fileName' portion of the namespace
|
||||
*/
|
||||
export default class ModuleDebugBuilder {
|
||||
constructor(appName, fileName) {
|
||||
this.INFO = Debug(`${appName}:${fileName}:INFO`);
|
||||
this.DEBUG = Debug(`${appName}:${fileName}:DEBUG`);
|
||||
this.WARN = Debug(`${appName}:${fileName}:WARNING`);
|
||||
this.ERROR = Debug(`${appName}:${fileName}:ERROR`);
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@ import {REST} from "@discordjs/rest";
|
||||
import {getApplicationID, getGuildID, getTOKEN} from "./configHandler.js";
|
||||
import { Routes, ChannelType } from "discord.js";
|
||||
// Debug
|
||||
import debugBuilder from "./debugBuilder.js";
|
||||
const log = new debugBuilder("bot", "registerCommands");
|
||||
import ModuleDebugBuilder from "./moduleDebugBuilder.js";
|
||||
const log = new ModuleDebugBuilder("bot", "registerCommands");
|
||||
|
||||
const pingCommand = new SlashCommandBuilder()
|
||||
.setName("ping")
|
||||
|
||||
Reference in New Issue
Block a user