Master-Bot
Master-Bot copied to clipboard
Log File Integration - Request
Request
I would like to request the addition of a logging feature that will log console logs such as errors and such to a file on the system. we3 could have it create a path called .logs and store then make a log file named after the date of which the event was logged.
So something like: Master-Bot/.logs/05-06-2022.log
I believe this would be very useful for tracking errors. Right now I have a startup script that tracks the startup but doesn't always create a new file on error since it only logs the npm run dev command.
This is what my startup script looks like:
#!/bin/sh:
var=`date +"%FORMAT_STRING"`
current_date=`date +"%m-%d-%Y"`
current_time=`date +"%H-%M-%S"`
echo "${current_date}_${current_time}"
logging_path="../../.logs/Master-Bot/${current_date}_${current_time}.log"
cd Master-Bot
npm run dev >>$logging_path 2>&1
I'm wanting something a little better than just this though. I'd like to see actual logging integration in the bot itself.
Howdy, wanted to let you know I've been working into this, but with some pretty big changes coming, it doesn't make sense to make a PR for this yet but Using winston and d91eaab build was able to make this really quick
if you want the added colors, uncomment the lines in logger.ts
Logging
outputs to the Master-Bot/logs/
creates a new log each day
keeps only the last 14 days of logs
output files are labeled Master-Bot-MM-DD-YYYY.log
example log
2022-06-07 16:21:32 info: Game-Search-Command - Enabled
2022-06-07 16:21:32 info: Twitch-Status-Command - Enabled
Much Love -Bacon
Howdy, wanted to let you know I've been working into this, but with some pretty big changes coming, it doesn't make sense to make a PR for this yet but Using winston and d91eaab build was able to make this really quick
if you want the added colors, uncomment the lines in
logger.tsLogging
outputs to the
Master-Bot/logs/creates a new log each day keeps only the last 14 days of logs output files are labeledMaster-Bot-MM-DD-YYYY.logexample log
2022-06-07 16:21:32 info: Game-Search-Command - Enabled 2022-06-07 16:21:32 info: Twitch-Status-Command - EnabledMuch Love -Bacon
Do you have the time to open a PR that merges this into main? If you can't (you said something about being out of town), I'll do it myself :)
Also thanks @PhantomNimbi for sponsoring me - means a lot to know you care about my OSS ❤️
Howdy, I'm back in town (Finally!!)
I've been working on this off and on while I was out.
Currently I was unable to get the sapphire ready messages or the redis errors to be in the log file .
the redis transport module for Winston has some major issues (not maintained atm)
Will post what I have once I complete some testing later on today or tomorrow
Much Love Bacon
Howdy,
Thank you again for the excellent suggestion! #737 Logger Integration has been merged, I'm going to close this request. If you find any bugs or have any other feature request/suggestions, please let us know :D
Much Love -Bacon