-
Notifications
You must be signed in to change notification settings - Fork 41
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
[POC] use logging module #565
Comments
Thanks @adebardo for the issue. It's ok for me globally.
|
Thank you for this feedback. |
It would be great to have the logging option indeed and be able to set it up through the CLI and API. We can also possibly add it to a global config file like what is done in geoutils.
Just out of curiosity, what is wrong with the f-string? Why would it have lower performance? I got used to the f-strings now because they are much easier to read. So I would try to use f-string whenever possible, i.e. outside of logging. |
Context
When using xdem errors and other types of information are displayed via
print
. The use of the logging module is more relevant, especially with the arrival of the CLI. This ticket, therefore proposes to replace all prints of xdem in logging.First, it is good to read the [documentation] (https://docs.python.org/en/3/howto/logging.html) in order to master the different levels and constraints related to the use
Code
The files affected by the changes are as follows:
-xdem/examples.py
xdem/affine.py
-xdem/base.py
-xdem/biascorr.py
-xdem/workflows.py
xdem/fit.py
-xdem/misc.py
-xdem/spatialstats.py
xdem/volume.py
example/plot_nuth_kaab.py
example/plot_block_wise_coreg.py
example/plor_deramp.py
example/plot_heterosc_estimation_modelling.py
example/plot_standardization.py
example/plot_variogram_estimation_modelling.py
example/plot_dem_substraction.py
example/plot_infer_heterosc.py
example/plot_infer_spatial_correlation.py
example/plot_spatial_error_propagation.py
test/test_coreg_pipeline.py
test/test_demcollection.py
test/test_doc.py
In xdem at the moment there is a verbose variable that if enabled then prints are displayed. Therefore, this variable must be removed from the APIs.
replace the prints with adequate logging.debug, logging.info, etc.
⚠️ f-string doesn’t pass pylint with logging we recommand using the percent formatting. (%s :string, %d int, %f float, ...)
Add some logs in run and tests it
For CLI
In xdem_cli.py add the function for setup the log https://github.com/CNES/demcompare/blob/master/demcompare/log_conf.py
and instanciate a file for saving https://github.com/CNES/demcompare/blob/master/demcompare/__init__.py#L92
Doc
Some help for an API use
Tests
Estimation 3d
The text was updated successfully, but these errors were encountered: