Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃挕Feature Request] Better Logging #182

Closed
shershah010 opened this issue Sep 17, 2021 · 3 comments 路 Fixed by #184
Closed

[馃挕Feature Request] Better Logging #182

shershah010 opened this issue Sep 17, 2021 · 3 comments 路 Fixed by #184
Assignees
Labels
enhancement New feature or request question Further information is requested
Milestone

Comments

@shershah010
Copy link
Collaborator

shershah010 commented Sep 17, 2021

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.

@shershah010 shershah010 added enhancement New feature or request question Further information is requested labels Sep 17, 2021
@tfukaza
Copy link
Owner

tfukaza commented Sep 17, 2021

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.

@tfukaza
Copy link
Owner

tfukaza commented Sep 17, 2021

Other log levels look good though :)

@tfukaza
Copy link
Owner

tfukaza commented Sep 17, 2021

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.

@shershah010 shershah010 self-assigned this Sep 17, 2021
@shershah010 shershah010 linked a pull request Sep 17, 2021 that will close this issue
@tfukaza tfukaza added this to the v0.2.1-alpha milestone Sep 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants