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

Some logging tidy-up #1034

Closed
1 of 3 tasks
dagewa opened this issue Nov 22, 2019 · 1 comment
Closed
1 of 3 tasks

Some logging tidy-up #1034

dagewa opened this issue Nov 22, 2019 · 1 comment
Labels

Comments

@dagewa
Copy link
Member

dagewa commented Nov 22, 2019

logger.warning is used in a few places in the codebase. Use is not very consistent:

  • logger.warning("*** WARNING: no reflections in job %d ***", index)
  • logger.warning("Restraints will be ignored for scan_varying=True")
  • logger.warning("Warning: Experiment crystals differ. Using first experiment crystal for file-level data.")

There are also warnings that aren't warnings

  • logger.info("Warning: %d reference spots were not matched to predictions" % (len(unmatched)))
  • It would be nice to have a consistent style. If logger.warning took care of the *** WARNING/Warning: or whatever prefix, this would help.

  • Capitalisation - Warning: experiment not Warning: Experiment preferred

  • Finally,

logger.info("\n")
logger.info("thing")
logger.info("\n")

one call per message please

@dagewa dagewa added the logging label Nov 22, 2019
@dagewa
Copy link
Member Author

dagewa commented Nov 27, 2019

@Anthchirp I'm wondering how adding a prefix like "WARNING:" to logger.warning messages would work. Is it something that can be added to dials.util.log.config?

dagewa added a commit that referenced this issue Dec 1, 2019
dagewa added a commit that referenced this issue Dec 16, 2019
dagewa added a commit that referenced this issue Dec 16, 2019
Completes another checkpoint for #1034
dagewa added a commit that referenced this issue Dec 16, 2019
* Prefix logger.warning messages with "WARNING:"

* Merge functionality with ElapsedFormatter.

Do not change formatting of console messages. Colours are preferable.

* Update util/log.py

* Suggestions from @Anthchirp

- Use the margin for the "WARN:" message
- Rename formatter

* Warning or above

* News

Completes another checkpoint for #1034

Co-Authored-By: Markus Gerstel <2102431+Anthchirp@users.noreply.github.com>
dagewa added a commit that referenced this issue Dec 17, 2019
Highlighting is done automatically by the formatter.

Closes #1034
@dagewa dagewa closed this as completed in ec1c3bc Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant