-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor logging functionality and add features #402
Comments
@MacOS - agree 100% with your assessment - and would appreciate your help and support to drive this logging improvement. As you note, it will require updates across the code-base. |
Great! I think it is a good idea to chop this up in smaller junks. May I suggest the following steps as a starting point for discussions, in that order.
Besides, it is really important that we agree on the logging format. The format I suggested has the obvious problem with the |
@MacOS is this still of any importance? if yes, i'd be happy to add these prs. |
Thank you for offering to help out, @EricLiclair. As far as I know, yes, it is. |
Proposed new feature or change
This issue is a first dump of my thoughts. Feel free to comment on it and improve it.
Motive
Logging functionality is currently implemented with the
print
function and thelogging
package. In addition, some of these are commented out for no apparent reason.The issue is that users want the logging to be done by one and only one way. In addition, the users want to inspect the logs in a log file.
I therefore propose to implement a coherent logging system. In this process, the following should be done.
print
andlogging
code,logging
package,update
strings in the messages,Example
Actual
As stated above, the logic is spread out throughout the code base. Here are some examples for each of the five points above.
print
used for logging.llmware/llmware/embeddings.py
Line 448 in e3435db
An commented out print statement.
llmware/llmware/embeddings.py
Line 294 in e3435db
A logging statement with
update
in it.llmware/llmware/embeddings.py
Lines 114 to 115 in e3435db
Desired
It is desirable to clean up the logging functionality and add logging to a file. The output of such a log message, should, for example,
or
Generally, the form should hence be
Existing solutions I looked for
Within the package, none, since it is currently not implemented at all.
Outside of the package, yes. A blueprint might be to take a look at how
flask
does it.Proposed solution
In
__init__.py
add the following.And then add in each module
Technical Analysis
The proposed efforts, and hence the changes, would clean the codebase (e.g. moving
print
class to thelogger
), streamline the logging functionality (e.g. adding thecreate_logger
function to configure the logger centrally), and add new features for permanent logging to a file, or files.Additional links
Logging HOWTO
Flask source code
The text was updated successfully, but these errors were encountered: