Master-Bot icon indicating copy to clipboard operation
Master-Bot copied to clipboard

Log File Integration - Request

Open PhantomNimbi opened this issue 3 years ago • 1 comments

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.

PhantomNimbi avatar Jun 06 '22 16:06 PhantomNimbi

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

working concept

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

Bacon-Fixation avatar Jun 07 '22 21:06 Bacon-Fixation

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

working concept

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

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 :)

galnir avatar Aug 04 '22 21:08 galnir

Also thanks @PhantomNimbi for sponsoring me - means a lot to know you care about my OSS ❤️

galnir avatar Aug 04 '22 21:08 galnir

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

Bacon-Fixation avatar Aug 06 '22 19:08 Bacon-Fixation

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

Bacon-Fixation avatar Aug 11 '22 22:08 Bacon-Fixation