Logging
Logging is integral in the Sendhooks engine, ensuring that every activity, whether it's an error or a success, is meticulously documented. This is particularly essential in systems where success is the norm, and failures are significant anomalies that require immediate attention.
Log Files
Log files in the Sendhooks engine are structured text files that meticulously record various types of logs. Each log file is named with a date, following a specific format:
YYYY-MM-DD.log
Log Format
Each log entry within the file adheres to a consistent format:
time="2024-05-29T07:41:19Z" level=info msg="starting sendhooks engine" date="2024-05-29 07:41:19"
This format includes the following components:
- time: The timestamp in ISO 8601 format (UTC).
- level: The log level indicating the severity of the log message (
info
,warning
,error
). - msg: The log message.
- date: The local date and time when the log entry was created.
Types of Logs
The Sendhooks engine primarily focuses on three types of logs:
- INFO
- Indicates general information about the application's running state.
- WARNING
- Indicates a potential issue that might need attention but does not stop the application from running.
- ERROR
- Indicates a significant problem that has occurred, often resulting in the application failing to perform a critical task.
Examples of Log Entries
Here are some examples of logs in the file:
time="2024-05-29T07:41:19Z" level=info msg="starting sendhooks engine" date="2024-05-29 07:41:19"
time="2024-05-29T07:57:52Z" level=warning msg="maximum retries reached: 0" date="2024-05-29 07:57:52"
time="2024-05-29T07:58:02Z" level=error msg="HTTP request failed with status code: 404, response body: {\"success\":false,\"error\":{\"message\":\"The route could not be found.\",\"id\":null}}" date="2024-05-29 07:58:02"
time="2024-05-29T07:58:05Z" level=error msg="error sending sendhooks: webhook sending failed with status: failed, response body: {\"success\":false,\"error\":{\"message\":\"The route could not be found.\",\"id\":null}}" date="2024-05-29 07:58:05"
Log Rotation
Log rotation is handled automatically on a daily basis. Each day, a new log file is created with the current date as its filename. This ensures that log files remain manageable and that logs are organized by date.