@kata-codes/yamdbf-log-to-file v1.2.4
yamdbf-log-to-file
yamdbf-log-to-file is a plugin for Discord bots that are written with YAMDBF+Discord.js that
extends the logging functionality to write all logs issued through the YAMDBF Logger to
a log file.
Installation
Install the package via npm:
npm i --save @kata-codes/yamdbf-log-to-fileNote: This plugin depends on YAMDBF >3.0.0, so obviously make sure
yamdbfis installed.
Usage
logToFile
Import logToFile from the plugin into your YAMBDF Client:
const { logToFile } = require('@kata-codes/yamdbf-log-to-file');logsPath
You should add a logsPath entry into your config file specifying where you would like the logs to populate.
After updating your config, add the following to your YAMDBF Client:
const logsPath: string = (config.logsPath) ? config.logsPath : __dirname;Note: The path must be an absolute path.
plugins array
Pass logToFile(logsPath) into your YAMDBF Client options plugins array field:
const client = new Client({
...
plugins: [logToFile(logsPath)]
});Log Persistence
You can optionally specify a number of days to keep your logs by passing a number as a parameter along with the logsPath:
const client = new Client({
...
plugins: [logToFile(logsPath, 7)]
});Note: If no
numberis specified,yamdbf-log-to-filewill maintain the last three (3) days of logs.
