Add logger to project #183

Merged
Vylpes merged 7 commits from feature/146-logger into develop 2024-03-15 17:33:12 +00:00
2 changed files with 18 additions and 18 deletions
Showing only changes of commit f812185937 - Show all commits

View file

@ -12,16 +12,16 @@ export default class AppLogger {
level: logLevel, level: logLevel,
format: format.combine( format: format.combine(
format.timestamp({ format.timestamp({
format: 'YYYY-MM-DD HH:mm:ss' format: "YYYY-MM-DD HH:mm:ss"
}), }),
format.errors({ stack: true }), format.errors({ stack: true }),
format.splat(), format.splat(),
customFormat, customFormat,
), ),
defaultMeta: { service: 'bot' }, defaultMeta: { service: "bot" },
transports: [ transports: [
new transports.File({ filename: 'error.log', level: 'error' }), new transports.File({ filename: "error.log", level: "error" }),
new transports.File({ filename: 'combined.log' }), new transports.File({ filename: "combined.log" }),
], ],
}); });
@ -31,12 +31,12 @@ export default class AppLogger {
format.colorize(), format.colorize(),
format.timestamp(), format.timestamp(),
customFormat, customFormat,
)})); )}));
} }
AppLogger.Logger = logger; AppLogger.Logger = logger;
AppLogger.LogInfo('AppLogger', `Log Level: ${logLevel}`); AppLogger.LogInfo("AppLogger", `Log Level: ${logLevel}`);
} }
public static LogError(label: string, message: string) { public static LogError(label: string, message: string) {

View file

@ -127,7 +127,7 @@ export class CoreClient extends Client {
}; };
} }
AppLogger.LogVerbose("Client", `Registered Channel Create Event`); AppLogger.LogVerbose("Client", "Registered Channel Create Event");
} }
public static RegisterChannelDeleteEvent(fn: (channel: DMChannel | NonThreadGuildBasedChannel) => void) { public static RegisterChannelDeleteEvent(fn: (channel: DMChannel | NonThreadGuildBasedChannel) => void) {
@ -150,7 +150,7 @@ export class CoreClient extends Client {
}; };
} }
AppLogger.LogVerbose("Client", `Registered Channel Delete Event`); AppLogger.LogVerbose("Client", "Registered Channel Delete Event");
} }
public static RegisterChannelUpdateEvent(fn: (channel: DMChannel | NonThreadGuildBasedChannel) => void) { public static RegisterChannelUpdateEvent(fn: (channel: DMChannel | NonThreadGuildBasedChannel) => void) {
@ -173,7 +173,7 @@ export class CoreClient extends Client {
}; };
} }
AppLogger.LogVerbose("Client", `Registered Channel Update Event`); AppLogger.LogVerbose("Client", "Registered Channel Update Event");
} }
public static RegisterGuildBanAddEvent(fn: (ban: GuildBan) => void) { public static RegisterGuildBanAddEvent(fn: (ban: GuildBan) => void) {
@ -196,7 +196,7 @@ export class CoreClient extends Client {
}; };
} }
AppLogger.LogVerbose("Client", `Registered Guild Ban Add Event`); AppLogger.LogVerbose("Client", "Registered Guild Ban Add Event");
} }
public static RegisterGuildBanRemoveEvent(fn: (channel: GuildBan) => void) { public static RegisterGuildBanRemoveEvent(fn: (channel: GuildBan) => void) {
@ -219,7 +219,7 @@ export class CoreClient extends Client {
}; };
} }
AppLogger.LogVerbose("Client", `Registered Guild Ban Remove Event`); AppLogger.LogVerbose("Client", "Registered Guild Ban Remove Event");
} }
public static RegisterGuildCreateEvent(fn: (guild: Guild) => void) { public static RegisterGuildCreateEvent(fn: (guild: Guild) => void) {
@ -242,7 +242,7 @@ export class CoreClient extends Client {
}; };
} }
AppLogger.LogVerbose("Client", `Registered Guild Create Event`); AppLogger.LogVerbose("Client", "Registered Guild Create Event");
} }
public static RegisterGuildMemberAddEvent(fn: (member: GuildMember) => void) { public static RegisterGuildMemberAddEvent(fn: (member: GuildMember) => void) {
@ -265,7 +265,7 @@ export class CoreClient extends Client {
}; };
} }
AppLogger.LogVerbose("Client", `Registered Guild Member Add Event`); AppLogger.LogVerbose("Client", "Registered Guild Member Add Event");
} }
public static RegisterGuildMemberRemoveEvent(fn: (member: GuildMember | PartialGuildMember) => void) { public static RegisterGuildMemberRemoveEvent(fn: (member: GuildMember | PartialGuildMember) => void) {
@ -288,7 +288,7 @@ export class CoreClient extends Client {
}; };
} }
AppLogger.LogVerbose("Client", `Registered Guild Member Remove Event`); AppLogger.LogVerbose("Client", "Registered Guild Member Remove Event");
} }
public static GuildMemebrUpdate(fn: (oldMember: GuildMember | PartialGuildMember, newMember: GuildMember) => void) { public static GuildMemebrUpdate(fn: (oldMember: GuildMember | PartialGuildMember, newMember: GuildMember) => void) {
@ -311,7 +311,7 @@ export class CoreClient extends Client {
}; };
} }
AppLogger.LogVerbose("Client", `Registered Guild Member Update Event`); AppLogger.LogVerbose("Client", "Registered Guild Member Update Event");
} }
public static RegisterMessageCreateEvent(fn: (message: Message<boolean>) => void) { public static RegisterMessageCreateEvent(fn: (message: Message<boolean>) => void) {
@ -334,7 +334,7 @@ export class CoreClient extends Client {
}; };
} }
AppLogger.LogVerbose("Client", `Registered Message Create Event`); AppLogger.LogVerbose("Client", "Registered Message Create Event");
} }
public static RegisterMessageDeleteEvent(fn: (message: Message<boolean> | PartialMessage) => void) { public static RegisterMessageDeleteEvent(fn: (message: Message<boolean> | PartialMessage) => void) {
@ -357,7 +357,7 @@ export class CoreClient extends Client {
}; };
} }
AppLogger.LogVerbose("Client", `Registered Message Delete Event`); AppLogger.LogVerbose("Client", "Registered Message Delete Event");
} }
public static RegisterMessageUpdateEvent(fn: (oldMessage: Message<boolean> | PartialMessage, newMessage: Message<boolean> | PartialMessage) => void) { public static RegisterMessageUpdateEvent(fn: (oldMessage: Message<boolean> | PartialMessage, newMessage: Message<boolean> | PartialMessage) => void) {
@ -380,7 +380,7 @@ export class CoreClient extends Client {
}; };
} }
AppLogger.LogVerbose("Client", `Registered Message Update Event`); AppLogger.LogVerbose("Client", "Registered Message Update Event");
} }
public static RegisterButtonEvent(buttonId: string, event: ButtonEvent, environment: Environment = Environment.All) { public static RegisterButtonEvent(buttonId: string, event: ButtonEvent, environment: Environment = Environment.All) {