update logger exports

This commit is contained in:
Marius Begby committed 2024-02-15 22:29:17 +01:00
1 parent cdf37ce503
commit e1b0aea7fc
62 files changed
+114 -152

No files matched your search

+2 -3
View File
@@ -1,7 +1,6 @@
import { Events } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
module.exports = {
name: Events.Debug,
@@ -9,7 +8,7 @@ module.exports = {
once: false,
execute: async (message: string) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'clientDebug',
executionId: executionId
+2 -3
View File
@@ -1,8 +1,7 @@
import config from 'config';
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
import { ExtendedClient } from '../../types/clientTypes';
import { EmbedOptions, SystemOptions } from '../../types/configTypes';
@@ -14,7 +13,7 @@ module.exports = {
once: false,
execute: async (client: ExtendedClient) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'clientDisconnect',
executionId: executionId,
+2 -3
View File
@@ -1,7 +1,6 @@
import { Events } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
module.exports = {
name: Events.Error,
@@ -9,7 +8,7 @@ module.exports = {
once: false,
execute: async (error: Error) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'clientError',
executionId: executionId
+2 -3
View File
@@ -1,7 +1,6 @@
import { Events, Guild } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
module.exports = {
name: Events.GuildCreate,
@@ -9,7 +8,7 @@ module.exports = {
once: false,
execute: async (guild: Guild) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'guildCreate',
executionId: executionId,
+2 -3
View File
@@ -1,7 +1,6 @@
import { Events, Guild } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
module.exports = {
name: Events.GuildDelete,
@@ -9,7 +8,7 @@ module.exports = {
once: false,
execute: async (guild: Guild) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'guildDelete',
executionId: executionId,
+3 -4
View File
@@ -1,8 +1,7 @@
import config from 'config';
import { BaseGuildTextChannel, EmbedBuilder, Events, PresenceData } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
import { ExtendedClient } from '../../types/clientTypes';
import { EmbedOptions, LoadTestOptions, SystemOptions } from '../../types/configTypes';
import { postBotStats } from '../../startup/postBotStats';
@@ -18,7 +17,7 @@ module.exports = {
once: false,
execute: async (client: ExtendedClient) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'clientReady',
executionId: executionId,
@@ -26,7 +25,7 @@ module.exports = {
});
logger.debug("Client 'ready' event received after 'allShardsReady' event.");
await client.user?.setPresence(presenceStatusOptions);
client.user?.setPresence(presenceStatusOptions);
if (loadTestOptions.enabled) {
// Only call function from shard with id 0
+2 -3
View File
@@ -1,8 +1,7 @@
import config from 'config';
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
import { ExtendedClient } from '../../types/clientTypes';
import { EmbedOptions, SystemOptions } from '../../types/configTypes';
@@ -14,7 +13,7 @@ module.exports = {
once: false,
execute: async (client: ExtendedClient) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'clientReconnecting',
executionId: executionId,
+2 -3
View File
@@ -1,7 +1,6 @@
import { Events } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
module.exports = {
name: Events.Warn,
@@ -9,7 +8,7 @@ module.exports = {
once: false,
execute: async (warning: string) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'clientWarn',
executionId: executionId
+2 -3
View File
@@ -7,13 +7,12 @@ import {
MessageComponentInteraction
} from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import { CustomError } from '../../common/classes/interactions';
import { handleAutocomplete } from '../../handlers/interactionAutocompleteHandler';
import { handleCommand } from '../../handlers/interactionCommandHandler';
import { handleComponent } from '../../handlers/interactionComponentHandler';
import { handleError } from '../../handlers/interactionErrorHandler';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
import { ExtendedClient } from '../../types/clientTypes';
module.exports = {
@@ -22,7 +21,7 @@ module.exports = {
execute: async (interaction: Interaction, { client }: { client: ExtendedClient }) => {
const inputTime: number = new Date().getTime();
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'interactionCreate',
executionId: executionId,
+2 -3
View File
@@ -1,6 +1,5 @@
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
module.exports = {
name: 'debug',
@@ -8,7 +7,7 @@ module.exports = {
isPlayerEvent: false,
execute: async (message: string) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'playerGeneralDebug',
executionId: executionId
+2 -3
View File
@@ -1,8 +1,7 @@
import config from 'config';
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
import { BotOptions, EmbedOptions, SystemOptions } from '../../types/configTypes';
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
import { useLanguageTranslator } from '../../common/utils/localeUtil';
@@ -17,7 +16,7 @@ module.exports = {
isPlayerEvent: true,
execute: async (queue: ExtendedGuildQueuePlayerNode, error: Error) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'playerGeneralError',
executionId: executionId,
+2 -3
View File
@@ -1,6 +1,5 @@
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
module.exports = {
name: 'error',
@@ -8,7 +7,7 @@ module.exports = {
isPlayerEvent: true,
execute: async (message: string) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'playerDebug',
executionId: executionId
+2 -3
View File
@@ -1,8 +1,7 @@
import config from 'config';
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
import { BotOptions, EmbedOptions, SystemOptions } from '../../types/configTypes';
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
import { useLanguageTranslator } from '../../common/utils/localeUtil';
@@ -18,7 +17,7 @@ module.exports = {
isPlayerEvent: true,
execute: async (queue: ExtendedGuildQueuePlayerNode, error: Error) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'playerError',
executionId: executionId,
+2 -3
View File
@@ -1,9 +1,8 @@
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
import { randomUUID as uuidv4 } from 'node:crypto';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
import { Track } from 'discord-player';
import { Snowflake } from 'discord.js';
import { Logger } from 'pino';
// Emitted when the audio player finish playing a track.
module.exports = {
@@ -12,7 +11,7 @@ module.exports = {
isPlayerEvent: true,
execute: async (queue: ExtendedGuildQueuePlayerNode, track: Track) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'playerFinish',
executionId: executionId,
+2 -3
View File
@@ -2,8 +2,7 @@ import config from 'config';
import { Track, TrackSkipReason } from 'discord-player';
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
import { BotOptions, EmbedOptions, SystemOptions } from '../../types/configTypes';
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
import { useLanguageTranslator } from '../../common/utils/localeUtil';
@@ -24,7 +23,7 @@ module.exports = {
description: string
) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'playerSkip',
executionId: executionId,
+2 -3
View File
@@ -3,9 +3,8 @@ import { useLanguageTranslator } from '../../common/utils/localeUtil';
import { EmbedBuilder, LocaleString } from 'discord.js';
import { EmbedOptions } from '../../types/configTypes';
import { randomUUID as uuidv4 } from 'node:crypto';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
import { Track } from 'discord-player';
import { Logger } from 'pino';
import config from 'config';
module.exports = {
@@ -14,7 +13,7 @@ module.exports = {
isPlayerEvent: true,
execute: async (queue: ExtendedGuildQueuePlayerNode, track: Track) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'playerStart',
executionId: executionId,
+2 -3
View File
@@ -1,7 +1,6 @@
import { Track } from 'discord-player';
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
import { User } from 'discord.js';
@@ -12,7 +11,7 @@ module.exports = {
isPlayerEvent: true,
execute: async (queue: ExtendedGuildQueuePlayerNode, tracks: Track[], done: (track: Track) => void) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'willAutoPlay',
executionId: executionId,
+2 -3
View File
@@ -1,13 +1,12 @@
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
module.exports = {
name: 'uncaughtException',
isDebug: false,
execute: async (error: Error) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'uncaughtException',
executionId: executionId
+2 -3
View File
@@ -1,13 +1,12 @@
import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino';
import loggerModule from '../../common/services/logger';
import { loggerService, Logger } from '../../common/services/logger';
module.exports = {
name: 'unhandledRejection',
isDebug: false,
execute: async (error: Error) => {
const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({
const logger: Logger = loggerService.child({
module: 'event',
name: 'unhandledRejection',
executionId: executionId