generated from nhcarrigan/template
feat: user-provided logger
This commit is contained in:
+4
-8
@@ -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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user