feat: user-provided logger

This commit is contained in:
2025-10-07 17:40:19 -07:00
parent 34e963250d
commit f838a89663
+3 -7
View File
@@ -4,8 +4,8 @@
* @author Naomi Carrigan * @author Naomi Carrigan
*/ */
import { Logger } from "@nhcarrigan/logger";
import { scheduleJob, type Job } from "node-schedule"; import { scheduleJob, type Job } from "node-schedule";
import type { Logger } from "@nhcarrigan/logger";
import type { Events, Client } from "discord.js"; import type { Events, Client } from "discord.js";
// eslint-disable-next-line complexity, max-lines-per-function, max-statements -- Justified // eslint-disable-next-line complexity, max-lines-per-function, max-statements -- Justified
@@ -71,21 +71,17 @@ const flatten = (
* A class for logging Discord bot analytics. * A class for logging Discord bot analytics.
*/ */
export class DiscordAnalytics { export class DiscordAnalytics {
private readonly logger: Logger;
private job: Job | null = null; private job: Job | null = null;
/** /**
* Creates a new instance of the DiscordAnalytics class. * Creates a new instance of the DiscordAnalytics class.
* @param client -- The Discord client to monitor. * @param client -- The Discord client to monitor.
* @param name -- The name of the application. * @param logger -- Instance of @nhcarrigan/logger to use for logging.
* @param logToken -- Auth token for our logging service.
*/ */
public constructor( public constructor(
private readonly client: Client, private readonly client: Client,
name: string, private readonly logger: Logger,
logToken: string,
) { ) {
this.logger = new Logger(name, logToken);
} }
/** /**