console logger extension
This commit is contained in:
parent
5450469f3a
commit
1929963dae
@ -3,7 +3,7 @@ const { combine, label, printf } = format;
|
||||
const moment = require('moment');
|
||||
const chalk = require('chalk');
|
||||
|
||||
const { DiscordWebhook } = require('./transports/');
|
||||
const { DiscordWebhook, ExtendedConsole } = require('./transports/');
|
||||
|
||||
const regex = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g //removes chalk formatting, will be used for the log FILES.
|
||||
|
||||
@ -19,7 +19,8 @@ class Logger {
|
||||
format.simple()
|
||||
),
|
||||
transports: [
|
||||
new transports.Console(),
|
||||
new ExtendedConsole(),
|
||||
//new transports.Console(),
|
||||
new transports.File({ filename: `logs/what.log` }),
|
||||
new transports.File({ filename: `logs/${this.date.replace(/ /g, '-')}-error.log`, level: 'error' }),
|
||||
new DiscordWebhook({ level: 'error' }) //Broadcast errors to a discord webhook.
|
||||
@ -30,7 +31,7 @@ class Logger {
|
||||
.on('shardCreate', (shard) => this.write(shard, "Shard created.", 'debug'))
|
||||
.on('message', (shard, message) => this._handleMessage(shard, message));
|
||||
|
||||
console.log("FUCK");
|
||||
//console.log("FUCK");
|
||||
this.logger.log('info', "Why tf isnt this working...");
|
||||
this.logger.log('error', "THERES A FUCKIN ERROR");
|
||||
|
||||
@ -54,10 +55,10 @@ class Logger {
|
||||
if(!config.npm.levels[type]) return undefined;
|
||||
|
||||
const color = Constants.Colors[type];
|
||||
const header = `${chalk[color](`[${this.date}][shard-${this._shardId(shard)}]`)}`;
|
||||
const header = `[${this.date}][shard-${this._shardId(shard)}]`;//`${chalk[color](`[${this.date}][shard-${this._shardId(shard)}]`)}`;
|
||||
//[04/02/2020 12:52:20][shard-00]
|
||||
|
||||
this.logger.log(type, `${header} ${string}`)
|
||||
this.logger.log(type, `${header} ${string}`);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* eslint-disable linebreak-style */
|
||||
module.exports = {
|
||||
DiscordWebhook: require('./DiscordWebhook.js')
|
||||
}
|
||||
DiscordWebhook: require('./DiscordWebhook.js'),
|
||||
ExtendedConsole: require('./ExtendedConsole.js')
|
||||
};
|
Loading…
Reference in New Issue
Block a user