linter pass
This commit is contained in:
parent
15025bcc01
commit
736df1b3af
@ -17,17 +17,17 @@ const Constants = {
|
|||||||
|
|
||||||
class Logger {
|
class Logger {
|
||||||
|
|
||||||
constructor(client, options) {
|
constructor (client, options) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
|
||||||
const transports = [
|
const transports = [
|
||||||
new FileExtension({ filename: `logs/${this.date.split(' ')[0]}.log`, level: 'debug' }), //Will NOT log "silly" logs, could change in future.
|
new FileExtension({ filename: `logs/${this.date.split(' ')[0]}.log`, level: 'debug' }), // Will NOT log "silly" logs, could change in future.
|
||||||
new FileExtension({ filename: `logs/errors/${this.date.split(' ')[0]}-error.log`, level: 'error' }),
|
new FileExtension({ filename: `logs/errors/${this.date.split(' ')[0]}-error.log`, level: 'error' }),
|
||||||
new Console({ level: 'silly' }) //Will log EVERYTHING.
|
new Console({ level: 'silly' }) // Will log EVERYTHING.
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!options.webhook.disabled) transports.push(new DiscordWebhook({ level: 'error', ...options.webhook })); //Broadcast errors to a discord webhook.
|
if (!options.webhook.disabled) transports.push(new DiscordWebhook({ level: 'error', ...options.webhook })); // Broadcast errors to a discord webhook.
|
||||||
|
|
||||||
this.logger = createLogger({
|
this.logger = createLogger({
|
||||||
levels: config.npm.levels,
|
levels: config.npm.levels,
|
||||||
@ -38,11 +38,11 @@ class Logger {
|
|||||||
transports
|
transports
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO: Add proper date-oriented filenames and add a daily rotation file (?).
|
// TODO: Add proper date-oriented filenames and add a daily rotation file (?).
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
write(type = 'silly', string = '') {
|
write (type = 'silly', string = '') {
|
||||||
|
|
||||||
const color = Constants.Colors[type];
|
const color = Constants.Colors[type];
|
||||||
const header = `${chalk[color](`[${this.date}][modmail]`)}`;
|
const header = `${chalk[color](`[${this.date}][modmail]`)}`;
|
||||||
@ -52,23 +52,23 @@ class Logger {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get date() {
|
get date () {
|
||||||
return moment().format("YYYY-MM-DD hh:mm:ss");
|
return moment().format("YYYY-MM-DD hh:mm:ss");
|
||||||
}
|
}
|
||||||
|
|
||||||
info(message) {
|
info (message) {
|
||||||
this.write('info', message);
|
this.write('info', message);
|
||||||
}
|
}
|
||||||
|
|
||||||
warn(message) {
|
warn (message) {
|
||||||
this.write('warn', message);
|
this.write('warn', message);
|
||||||
}
|
}
|
||||||
|
|
||||||
error(message) {
|
error (message) {
|
||||||
this.write('error', message);
|
this.write('error', message);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug(message) {
|
debug (message) {
|
||||||
this.write('debug', message);
|
this.write('debug', message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user