Enhance Error Handling when `WebhookLogger` is Called
The main function of our application currently calls logging.WebhookLogger without handling potential errors it may return. We need to ensure all error scenarios are appropriately caught and logged to ensure consistent behavior and visibility into issues.
Steps to Reproduce:
- Start the application.
- Trigger a scenario where
logging.WebhookLoggermight fail (can't open logging file).
Expected Behavior:
The application should log the error (possibly using another mechanism) and continue running if possible.
Actual Behavior:
The application might miss logging errors if WebhookLogger fails, reducing our visibility into potential issues.
@LewisYann @asiedu-kev what do you think?
@koladev32 I would like to work on this
It's important....log file didn't open, sending failed, and we are in a kind of Blackout ... :joy:
@faizan0372 sure, go ahead.
Hi, Do we have a doc to set up the project on Windows.
@faizan0372 that's a great question actually but we do not have a specific setup for Windows. But you can find out how to setup on this documentation https://github.com/koladev32/sendhooks-engine/blob/main/CONTRIBUTING.md
But here are the steps you should follow with Windows :
For Command Prompt:
git clone https://github.com/koladev32/sendhooks-engine.git
cd sendhooks-engine
go mod download
For powershell
git clone https://github.com/koladev32/sendhooks-engine.git
cd .\sendhooks-engine\
go mod download
Also, make sure that you have the Redis server running by default at this address localhost:6379. Or if you have a custom Redis configuration 👇
In the sendhooks-engine directory, in the webhooks Golang module (directory), create a file called .env. This file is read by Golang to know which Redis information to use to establish a connection and start listening to the pub/sub channels.
# Redis Configuration
REDIS_ADDRESS=<REDIS_ADDRESS>
By default, the engine listens to a Redis channel called hooks. But you can modify it by giving your own value on the env variable REDIS_CHANNEL_NAME.
Hope it helps. 😇