HEJOK254 / Discord-QuickEdit

A discord application allowing users to quickly trim/edit/convert files, like videos.
2 stars 2 forks source link

Implement a (proper) logger #12

Closed HEJOK254 closed 2 weeks ago

BloodyMilchShake commented 1 month ago

I would like to contribute. Is there a guide on how to setup the project so I can test my changes?

BloodyMilchShake commented 1 month ago

For example the program wants a config file which apparently holds the api key but I think it would be helpful if there was an easy to read guide that would explain how the program is set up and what said config file expects.

HEJOK254 commented 1 month ago

I would like to contribute. Is there a guide on how to setup the project so I can test my changes?

I haven't yet written a contribution guide, but I'm planning on doing so.

You should be able to build the project by simply cloning the repo and opening it in Visual Studio, the only thing requiring manual setup is the config.json file, that you should put in the directory of your executable, usually for the Debug configuration.\ The directory should be located in <Project Directory>/bin/<Build Configuration (usually Debug)>/net8.0/ (after you've built the project)

A basic configuration file looks like this:

{
  "token": "YOUR DISCORD BOT TOKEN HERE",
  "statusType": "CustomStatus",
  "status": "Status",
  "debug": true
}

You can acquire the token on the Discord Developers site, after creating your application (see the Creating a Discord Bot section of https://docs.discordnet.dev/guides/getting_started/first-bot.html). Note that the guide is a little outdated and the bot should be set up using User Install, otherwise the commands won't work. Discord provides more recent documentation, including the User Installable App guide, but it's for a node project, so you can just ignore the code part and follow Step 1: Creating an App.

The rest of the values can be safely ignored, as they're optional. You can consider setting debug to true, as it will show log messages that you mark as Verbose, but it's once again optional.

BloodyMilchShake commented 1 month ago

Well thanks a lot for the explanation, I will try and set up everything in the next few days and then try to commit to some of the issues :D

smellilac commented 1 month ago

If I understand correctly, you need to configure a logger.

In this case, I suggest using Serilog (I am familiar with it, so I can quickly fix this problem.

If the library suits you, then I suggest choosing which type of data recording interests you. For example: to a database or to a file that will be located in the project directory

smellilac commented 1 month ago

Well thanks a lot for the explanation, I will try and set up everything in the next few days and then try to commit to some of the issues :D

BloodyMilchShake

@BloodyMilchShake, we can try to do this together. Cool experience :blush:

HEJOK254 commented 1 month ago

If I understand correctly, you need to configure a logger.

In this case, I suggest using Serilog (I am familiar with it, so I can quickly fix this problem.

If the library suits you, then I suggest choosing which type of data recording interests you. For example: to a database or to a file that will be located in the project directory

I was originally planning to write my own basic logger, but it's probably not worth it now that I'm thinking about it :P

After looking into the library, I think it should fit well, so you can work on it if you want :)

BloodyMilchShake commented 1 month ago

Well thanks a lot for the explanation, I will try and set up everything in the next few days and then try to commit to some of the issues :D

BloodyMilchShake

@BloodyMilchShake, we can try to do this together. Cool experience :blush:

Sure thing :)

smellilac commented 1 month ago

If I understand correctly, you need to configure a logger. In this case, I suggest using Serilog (I am familiar with it, so I can quickly fix this problem. If the library suits you, then I suggest choosing which type of data recording interests you. For example: to a database or to a file that will be located in the project directory

I was originally planning to write my own basic logger, but it's probably not worth it now that I'm thinking about it :P

After looking into the library, I think it should fit well, so you can work on it if you want :)

A few questions: Will writing logs to a file work?

And is it worth adding detailed logs? Possible log extensions are presented below.

1) Machine name (host) in each log. 2) ID of the thread from which the registration was made. 3) Enable process ID. 4) Adding a username from the current environment.

smellilac commented 1 month ago

Well thanks a lot for the explanation, I will try and set up everything in the next few days and then try to commit to some of the issues :D

BloodyMilchShake

@BloodyMilchShake, we can try to do this together. Cool experience 😊

Sure thing :)

@BloodyMilchShake, then I will start developing on my fork of this repository. I will be waiting for your contribution.

If you will have any questions/suggestions, you can write to me by email.

smellilac commented 1 month ago

I have set up the logger, but I can't test it.

It turns out that in addition to config.oson, you also need the ffmpeg.exe file.

If possible, provide more detailed information about installing and running the application.

I'm ready to upload a commit with a logger, I'm waiting for your opinion and email to indicate it as co-author @BloodyMilchShake!

HEJOK254 commented 1 month ago

It turns out that in addition to config.oson, you also need the ffmpeg.exe file.

If possible, provide more detailed information about installing and running the application.

It seems I've forgotten to mention that The program needs ffmpeg to be installed on the system. It should automatically detect it, if it's in the system path variable. If not, it should be possible to supply the program with a custom path using an additional json config file, as said in the FFMpegCore readme here.

You can install ffmpeg on windows by using winget: winget install ffmpeg, or on linux using sudo apt install ffmpeg (https://www.ffmpeg.org/download.html)

I'm also going to add a check for ffmpeg, so the program logs a helpful error message on start if it can't detect ffmpeg when you add the logger