You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python DB Logger is a private repository, which makes it not usable by people outside CTS-IT. It also requires setup of MySQL containers on the machine Nacculator is running. This is a major problem if Nacculator is being run by anyone other than the CTS-IT team.
Solution:
Make DB Logger an optional feature by allowing a flag to be passed during runtime that enables or disables Python DB Logger's functionality.
Where can the code be added?
There are ways to implement this, one such way is as follows:
If the flag is set to enable the logs, the DB Logger instance is created as is
But when it is disabled, we can set the instance to None.
Importing the instance will then either be a DBLogger instance or None. To ensure null safety, all DB Logger calls should be wrapped inside an if-else block that checks if the instance is None or not.
A drawback of this method is that it introduces a lot of redundant and dirty-looking extra if-else statements to the code. Hence, a better solution will be incorporate an enable/disable functionality in Python DB Logger itself.
The text was updated successfully, but these errors were encountered:
Problem:
Python DB Logger is a private repository, which makes it not usable by people outside CTS-IT. It also requires setup of MySQL containers on the machine Nacculator is running. This is a major problem if Nacculator is being run by anyone other than the CTS-IT team.
Solution:
Make DB Logger an optional feature by allowing a flag to be passed during runtime that enables or disables Python DB Logger's functionality.
Where can the code be added?
There are ways to implement this, one such way is as follows:
If the flag is set to enable the logs, the DB Logger instance is created as is
nacculator/nacc/logger.py
Lines 16 to 20 in ca9ce6c
But when it is disabled, we can set the instance to
None
.Importing the instance will then either be a
DBLogger
instance orNone
. To ensure null safety, all DB Logger calls should be wrapped inside an if-else block that checks if the instance is None or not.A drawback of this method is that it introduces a lot of redundant and dirty-looking extra if-else statements to the code. Hence, a better solution will be incorporate an enable/disable functionality in Python DB Logger itself.
The text was updated successfully, but these errors were encountered: