Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a (proper) logger #12

Closed
HEJOK254 opened this issue Jul 21, 2024 · 12 comments · Fixed by #21
Closed

Implement a (proper) logger #12

HEJOK254 opened this issue Jul 21, 2024 · 12 comments · Fixed by #21
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@HEJOK254
Copy link
Owner

No description provided.

@HEJOK254 HEJOK254 converted this from a draft issue Jul 21, 2024
@HEJOK254 HEJOK254 added enhancement New feature or request good first issue Good for newcomers labels Jul 21, 2024
@BloodyMilchShake
Copy link

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

@BloodyMilchShake
Copy link

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
Copy link
Owner Author

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
Copy link

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
Copy link
Contributor

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
Copy link
Contributor

smellilac commented Jul 22, 2024

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 😊

@HEJOK254
Copy link
Owner Author

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
Copy link

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

@smellilac
Copy link
Contributor

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
Copy link
Contributor

smellilac commented Jul 24, 2024

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
Copy link
Contributor

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
Copy link
Owner Author

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

@HEJOK254 HEJOK254 linked a pull request Aug 3, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this from Ready to Done in Discord QuickEdit Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants