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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging enhancements #35

Open
3 tasks
sadielbartholomew opened this issue May 19, 2020 · 0 comments
Open
3 tasks

Logging enhancements #35

sadielbartholomew opened this issue May 19, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@sadielbartholomew
Copy link
Member

sadielbartholomew commented May 19, 2020

Follow-on from #31. Now the infrastructure for logging is in place, we can make good use of it with some extensions [feel free to add to this listing, anyone!]:

  • Add logging to manage & configure verbose flag logic #31 did not add new logging calls, it simply replaced print calls existing at that point, which only existed on any equals methods & read or write functions. We should:

    • add meaningful messages across the codebase at applicable levels;
    • add a verbose kwarg to any function that ends up with a significant amount of log calls.
  • Improved display in log calls of objects for readability. For example, using pprint.pformat to print dictionary or list structures with an item per line, to make it easy to pick out a particular item especially where the structure has many items so it would otherwise be difficult. I have already changed a few messages in read_write.netcdf.netcdfread as such, e.g:

    logger.detail(
    " Global attributes:\n" +
    pformat(g['global_attributes'], indent=4)
    ) # pragma: no cover

  • Currently log messages go, as the equivalent print() statements did, to STDOUT as pure messages i.e. no extra metadata such as datetime stamps are included, just log level, logger name, & the message itself. However I think it would be beneficial to have at least one new handler to provide (all logging messages plus) (date)time stamps, calls made by the user, and exceptions which get raised outside of the logging system.

    I think a file handler is best such that the user can specify a path where a named dedicated log file gets written out (& rolled if there is the potential for it to get large enough) with every possible detail (i.e. set cfdm.LOG_LEVEL('DEBUG') for that handler). This would be great for user support & debugging purposes.

    • for this handler, add functionality to print timestamped calls that are run by the user (not just the log messages themselves).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant