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
Create a python file that creates a logger and have all files that log import this file. This file should create a logger and configure it.
Suggested logging strategy
DEBUG: Called at the start of every function and prints the message name and all arguments. Typically not shown to user.
INFO: Let users know of important things that occur. To give users confidence that the program is running as expected.
WARNING: Something bad happened and harvest can automatically fix the issue without any user input. For example if the user tries to get stock data from over a period of time that their account allows, we can fix that start time.
ERROR: Something unexpected happened but can easily be fixed. Like the user tried to add a stock ticker that does not exists or tried to add a stock ticker to a broker that only supports crypto or API call failed, we could try redoing the api call.
raise Exception: Something really bad happened and the entire system must be shutdown because there is no way to recover. This could be a call to a function that should return something without a solid null case. For example returning an empty list is a fine null case but an empty dictionary or None isn't (since no one checks for the None case).
Let me know if this sounds good or if there is anything I should change.
The text was updated successfully, but these errors were encountered:
Not sure if we should print every function call for DEBUG level. The primary purpose of the debug log will be for debugging, so although we want to be detailed, we also don't want to bloat the log and make it harder to go through for devs. Instead of printing every parameter in a function, we should instead print stuff that are contextually useful for debugging.
One last comment: if you're suggesting we create a separate module logging it might be a bit overkill. The logging module in Python is already pretty well modularized, it might be enough unless you were thinking of adding some fancy features like generating multiple log files or sending email messages to users for critical logs.
Create a python file that creates a logger and have all files that log import this file. This file should create a logger and configure it.
Suggested logging strategy
None
isn't (since no one checks for the None case).Let me know if this sounds good or if there is anything I should change.
The text was updated successfully, but these errors were encountered: