mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 14:38:49 +00:00
update logger exports
This commit is contained in:
1 parent
cdf37ce503
commit
e1b0aea7fc
62 files changed
+114
-152
No files matched your search
@@ -13,8 +13,7 @@ import {
|
||||
SlashCommandBuilder,
|
||||
SlashCommandSubcommandsOnlyBuilder
|
||||
} from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../services/logger';
|
||||
import { loggerService, Logger } from '../services/logger';
|
||||
import { BotOptions, EmbedOptions, PlayerOptions } from '../../types/configTypes';
|
||||
import {
|
||||
BaseAutocompleteParams,
|
||||
@@ -45,7 +44,7 @@ abstract class BaseInteraction {
|
||||
executionId: string,
|
||||
interaction: Interaction | MessageComponentInteraction
|
||||
): Logger {
|
||||
return loggerModule.child({
|
||||
return loggerService.child({
|
||||
module: module,
|
||||
name: name,
|
||||
executionId: executionId,
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import Discord, { Client } from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../services/logger';
|
||||
import { loggerService, Logger } from '../services/logger';
|
||||
|
||||
export const createClient = async ({ executionId }: { executionId: string }): Promise<Client> => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
const logger: Logger = loggerService.child({
|
||||
module: 'utilFactory',
|
||||
name: 'createClient',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import config from 'config';
|
||||
import { IPRotationConfig, Player } from 'discord-player';
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../services/logger';
|
||||
import { loggerService, Logger } from '../services/logger';
|
||||
import { CreatePlayerParams } from '../../types/playerTypes';
|
||||
|
||||
export const createPlayer = async ({ client, executionId }: CreatePlayerParams): Promise<Player> => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
const logger: Logger = loggerService.child({
|
||||
module: 'utilFactory',
|
||||
name: 'createPlayer',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { usePrismaClient } from './prismaClient';
|
||||
import loggerModule from './logger';
|
||||
import { Logger } from 'pino';
|
||||
import { loggerService, Logger } from './logger';
|
||||
import { Interaction, MessageComponentInteraction } from 'discord.js';
|
||||
|
||||
const prisma = usePrismaClient();
|
||||
|
||||
function getLogger(executionId: string, interaction?: Interaction | MessageComponentInteraction): Logger {
|
||||
return loggerModule.child({
|
||||
return loggerService.child({
|
||||
module: 'databaseService',
|
||||
name: 'guildDatabaseService',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable no-console */
|
||||
import config from 'config';
|
||||
import pino, { DestinationStream, Logger, LoggerOptions } from 'pino';
|
||||
import pino, { DestinationStream, Logger as PinoLogger, LoggerOptions } from 'pino';
|
||||
import { CustomLoggerOptions } from '../../types/configTypes';
|
||||
import { TargetOptions } from '../../types/serviceTypes';
|
||||
|
||||
@@ -103,5 +103,6 @@ const logLevelConfig: LoggerOptions = {
|
||||
base: defaultProperties
|
||||
};
|
||||
|
||||
const logger: Logger = pino(logLevelConfig, transport);
|
||||
export default logger;
|
||||
export type Logger = PinoLogger;
|
||||
export const loggerService: Logger = pino(logLevelConfig, transport);
|
||||
export default loggerService;
|
||||
@@ -1,10 +1,9 @@
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../services/logger';
|
||||
import { loggerService, Logger } from '../services/logger';
|
||||
import { GetUptimeFormattedParams } from '../../types/utilTypes';
|
||||
import { formatDuration } from './formattingUtils';
|
||||
|
||||
export const getUptimeFormatted = ({ executionId }: GetUptimeFormattedParams): string => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
const logger: Logger = loggerService.child({
|
||||
module: 'utilSystem',
|
||||
name: 'getUptimeFormatted',
|
||||
executionId: executionId
|
||||
|
||||
@@ -8,16 +8,15 @@ import {
|
||||
VoiceBasedChannel,
|
||||
VoiceChannel
|
||||
} from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import { InteractionValidationError } from '../classes/interactions';
|
||||
import loggerModule from '../services/logger';
|
||||
import { loggerService, Logger } from '../services/logger';
|
||||
import { EmbedOptions } from '../../types/configTypes';
|
||||
import { ValidatorParams } from '../../types/utilTypes';
|
||||
import { useServerTranslator } from '../utils/localeUtil';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
export const checkVoicePermissionJoinAndTalk = async ({ interaction, executionId }: ValidatorParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
const logger: Logger = loggerService.child({
|
||||
module: 'utilValidation',
|
||||
name: 'cannotJoinVoiceOrTalk',
|
||||
executionId: executionId,
|
||||
@@ -63,7 +62,7 @@ export const checkVoicePermissionJoinAndTalk = async ({ interaction, executionId
|
||||
};
|
||||
|
||||
export const checkChannelPermissionViewable = async ({ interaction, executionId }: ValidatorParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
const logger: Logger = loggerService.child({
|
||||
module: 'utilValidation',
|
||||
name: 'cannotSendMessageInChannel',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import config from 'config';
|
||||
import { EmbedBuilder, GuildMember, InteractionType } from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import { InteractionValidationError } from '../classes/interactions';
|
||||
import loggerModule from '../services/logger';
|
||||
import { loggerService, Logger } from '../services/logger';
|
||||
import { EmbedOptions } from '../../types/configTypes';
|
||||
import { ValidatorParams } from '../../types/utilTypes';
|
||||
import { useServerTranslator } from '../utils/localeUtil';
|
||||
@@ -10,7 +9,7 @@ import { formatSlashCommand } from '../utils/formattingUtils';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
export const checkQueueExists = async ({ interaction, queue, executionId }: ValidatorParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
const logger: Logger = loggerService.child({
|
||||
module: 'utilValidation',
|
||||
name: 'queueDoesNotExist',
|
||||
executionId: executionId,
|
||||
@@ -52,7 +51,7 @@ export const checkQueueExists = async ({ interaction, queue, executionId }: Vali
|
||||
};
|
||||
|
||||
export const checkHistoryExists = async ({ interaction, history, executionId }: ValidatorParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
const logger: Logger = loggerService.child({
|
||||
module: 'utilValidation',
|
||||
name: 'historyDoesNotExist',
|
||||
executionId: executionId,
|
||||
@@ -94,7 +93,7 @@ export const checkHistoryExists = async ({ interaction, history, executionId }:
|
||||
};
|
||||
|
||||
export const checkQueueCurrentTrack = async ({ interaction, queue, executionId }: ValidatorParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
const logger: Logger = loggerService.child({
|
||||
module: 'utilValidation',
|
||||
name: 'queueNoCurrentTrack',
|
||||
executionId: executionId,
|
||||
@@ -136,7 +135,7 @@ export const checkQueueCurrentTrack = async ({ interaction, queue, executionId }
|
||||
};
|
||||
|
||||
export const checkQueueEmpty = async ({ interaction, queue, executionId }: ValidatorParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
const logger: Logger = loggerService.child({
|
||||
module: 'utilValidation',
|
||||
name: 'queueIsEmpty',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../services/logger';
|
||||
import { loggerService, Logger } from '../services/logger';
|
||||
import { TransformQueryParams } from '../../types/utilTypes';
|
||||
|
||||
export const transformQuery = ({ query, executionId }: TransformQueryParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
const logger: Logger = loggerService.child({
|
||||
module: 'utilValidation',
|
||||
name: 'transformQuery',
|
||||
executionId: executionId
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import config from 'config';
|
||||
import { EmbedBuilder, InteractionType } from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import { InteractionValidationError } from '../classes/interactions';
|
||||
import loggerModule from '../services/logger';
|
||||
import { loggerService, Logger } from '../services/logger';
|
||||
import { EmbedOptions, SystemOptions } from '../../types/configTypes';
|
||||
import { ValidatorParams } from '../../types/utilTypes';
|
||||
import { useServerTranslator } from '../utils/localeUtil';
|
||||
@@ -11,7 +10,7 @@ import { formatSlashCommand } from '../utils/formattingUtils';
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
const systemOptions: SystemOptions = config.get('systemOptions');
|
||||
export const checkValidGuildId = async ({ interaction, executionId }: ValidatorParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
const logger: Logger = loggerService.child({
|
||||
module: 'utilValidation',
|
||||
name: 'notValidGuildId',
|
||||
executionId: executionId,
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import config from 'config';
|
||||
import { EmbedBuilder, GuildMember, InteractionType } from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import { InteractionValidationError } from '../classes/interactions';
|
||||
import loggerModule from '../services/logger';
|
||||
import { loggerService, Logger } from '../services/logger';
|
||||
import { EmbedOptions } from '../../types/configTypes';
|
||||
import { ValidatorParams } from '../../types/utilTypes';
|
||||
import { useServerTranslator } from '../utils/localeUtil';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
export const checkInVoiceChannel = async ({ interaction, executionId }: ValidatorParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
const logger: Logger = loggerService.child({
|
||||
module: 'validator',
|
||||
name: 'notInVoiceChannel',
|
||||
executionId: executionId,
|
||||
@@ -47,7 +46,7 @@ export const checkInVoiceChannel = async ({ interaction, executionId }: Validato
|
||||
};
|
||||
|
||||
export const checkSameVoiceChannel = async ({ interaction, queue, executionId }: ValidatorParams) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
const logger: Logger = loggerService.child({
|
||||
module: 'utilValidation',
|
||||
name: 'notInSameVoiceChannel',
|
||||
executionId: executionId,
|
||||
|
||||
Reference in new issue
Block a user