Implemented the event_logging class that uses the Python logging module. The objective of this class is to provide fail-safe and redundant logging that can be easily integrated into the existing source.
The log handler will attempt to insert the event into the logging table and send a message to specified Discord channels. In the event that neither the database nor Discord are reachable a message will be printed to the console. Due to constraints with the docker configuration, storing events in a local file is currently not implemented.
Environment variables have been added to specify which Discord channel each log should be posted in and the minimum log level that the event must meet to be sent to Discord (posting to Discord adds .2 - .3 seconds of latency and this variable can be used to eliminate Discord logging) (i.e. setting DISCORD_MIN_TO_LOG to 30 would prevent info and debug events from being sent to Discord).
Added basic event logging to the existing source code. Additional event logging can now be easily expanded/added.
Added:
*The follow should be set to a Discord channel ID
DISCORD_LOG_CHANNEL_CRITICAL
DISCORD_LOG_CHANNEL_ERROR
DISCORD_LOG_CHANNEL_WARNING
DISCORD_LOG_CHANNEL_INFO
DISCORD_LOG_CHANNEL_DEBUG
DISCORD_LOG_CHANNEL_NOTSET
*This should be set to a value corresponding with the "levelno"
DISCORD_MIN_TO_LOG
Implemented the
event_logging
class that uses the Python logging module. The objective of this class is to provide fail-safe and redundant logging that can be easily integrated into the existing source.The log handler will attempt to insert the event into the
logging
table and send a message to specified Discord channels. In the event that neither the database nor Discord are reachable a message will be printed to the console. Due to constraints with the docker configuration, storing events in a local file is currently not implemented.Environment variables have been added to specify which Discord channel each log should be posted in and the minimum log level that the event must meet to be sent to Discord (posting to Discord adds .2 - .3 seconds of latency and this variable can be used to eliminate Discord logging) (i.e. setting DISCORD_MIN_TO_LOG to 30 would prevent info and debug events from being sent to Discord).
Added basic event logging to the existing source code. Additional event logging can now be easily expanded/added.
Added: *The follow should be set to a Discord channel ID DISCORD_LOG_CHANNEL_CRITICAL DISCORD_LOG_CHANNEL_ERROR DISCORD_LOG_CHANNEL_WARNING DISCORD_LOG_CHANNEL_INFO DISCORD_LOG_CHANNEL_DEBUG DISCORD_LOG_CHANNEL_NOTSET
*This should be set to a value corresponding with the "levelno" DISCORD_MIN_TO_LOG