NCAS-CMS / NCAS-CMS/cf-python

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

Offen
#256 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

code tidy
Vorherrschende Sprache
Python
Sterne
150
Forks
23
Ø Merge
1 T. 11 Std.
Gemergte PRs (30 T.)
2

Beschreibung

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).

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, die referenzierten Logging-Blöcke in cf/field.py um die Zeilen 480–483 und 1724–1735 zu prüfen, und suche anschließend in den Modulen nach ähnlichen Meldungen. Kläre, ob das Dienstprogramm nur die Ausgabe von Name/Wert konsolidieren oder auch hübsch formatierte und maschinenabfragbare Datensätze unterstützen soll. Als erledigt gilt die Aufgabe, wenn ein abgestimmter Umfang und Tests vorliegen, die das ausgewählte Ausgabeverhalten abdecken.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
observability-sre
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.