NCAS-CMS / NCAS-CMS/cf-python

Utility to consolidate log messages of form f"X={X}"

Open
#256 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

code tidy
Dominant language
Python
Stars
150
Forks
23
Avg merge
1d 11h
Merged PRs (30d)
2

Description

Particularly in the field module, but also frequently elsewhere throughout the modules in the codebase, we have logging or error messages (often for debugging but not always) which name a variable and then print it's value, for example across these blocks from field (though not always contiguously so as to be condensable into one statement):

https://github.com/NCAS-CMS/cf-python/blob/af15b433ea88fb3cbb712bea6c5e5a0c24f88dff/cf/field.py#L480-L483

and
https://github.com/NCAS-CMS/cf-python/blob/af15b433ea88fb3cbb712bea6c5e5a0c24f88dff/cf/field.py#L1724-L1735

These aren't necessarily troublesome and not usually user-facing (unless the user is hardcore and debugging), but to add flexibility of pretty-printed output (indentation, etc., even allowing for support of a machine-parsable output which can be queried rather than eyeballed for serious debugging) and reduce duplication it might be good to create a method that manages the logic of printing the name and value (and perhaps registering in some structure for such easy querying).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the referenced logging blocks in cf/field.py around lines 480–483 and 1724–1735, then search the modules for similar messages. Clarify whether the utility should only consolidate name/value output or also support pretty-printed and machine-queryable records. Done requires an agreed scope and tests covering the chosen output behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability-sre
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.