Each logs have levels that are primarily used for ignoring logs, see Ignoring logs.
Logger.ts
enumLogLevel { OFF =0, ERROR =1, WARNING =2, INFO =3, EVENT =4, LOG =5, DEBUG =6, COMMENT =7, ALL =7,}
Ignoring logs
There are multiple way to ignore logs.
You can ignore whole multiple levels of logs like this :
Logger.LEVEL=LogLevel.INFO// this will not be logged because 'log' level is lower than 'info' level.Logger.log('something');// this will be loggedLogger.info('something');
You can also ignore logs by titles using ignores property, the title is the second argument you put in every logs methods, it will always be defaulted to the name of the log level.
Logger.ignores.push('myTitle');// This will not be logged because title is 'myTitle'Logger.warn('this is a message','myTitle');
Finally you can ignore logs by titles and by levels.
Logger.ignores.push(['something',LogLevel.LOG]);// This will not be logged because title is 'something' and level is 'log'Logger.log('bla bla','something');// This will be logged because level is not 'log'Logger.warn('bla bla','something');// You can also use strings for defining the name of the levelLogger.ignores.push(['something','COMMENT']);
Saving logs
You can add files where to save logs using the CreateCommandHandlerOptions#savingFiles property when creating your CommandHandler.
const {CommandHandler} =require('advanced-command-handler');CommandHandler.create({ commandsDir:'commands', eventsDir:'events', saveLogsInFile: ['a.txt','logs.txt']}).launch({ token:'the token of my bot'});
If the files are not found, it will try to create them, else it will append logs to them.