Skip to content

Create the Logging and Output guidelines#4935

Open
psss wants to merge 8 commits into
mainfrom
psss-logging-and-output
Open

Create the Logging and Output guidelines#4935
psss wants to merge 8 commits into
mainfrom
psss-logging-and-output

Conversation

@psss
Copy link
Copy Markdown
Member

@psss psss commented May 28, 2026

Add a new section defining the individual output types and individual verbosity levels. Describes the target state to which we want to get.

Fix #4814.

Pull Request Checklist

  • write the documentation
  • include a release note

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a new 'Logging and Output' section to the contribution documentation (docs/contribute.rst) to clarify the distinction between logging (stderr) and output (stdout), and to define verbosity and debug levels. Feedback recommends formatting the logging method names as inline literals for consistent rendering, and adding a note to clarify that using the level parameter with info() is a planned target state, as the current implementation requires using verbose() instead.

Comment thread docs/contribute.rst Outdated
Comment thread docs/contribute.rst
@psss psss added documentation Improvements or additions to documentation code | logging Changes related to debug logging area | contribute Improving experience for tmt contributors labels May 28, 2026
@psss psss added this to planning May 28, 2026
@github-project-automation github-project-automation Bot moved this to backlog in planning May 28, 2026
@psss psss moved this from backlog to review in planning May 28, 2026
Comment thread docs/contribute.rst
Comment thread docs/contribute.rst Outdated
Comment thread docs/contribute.rst Outdated
Comment thread docs/contribute.rst Outdated
Comment thread docs/contribute.rst
Comment thread docs/contribute.rst Outdated
Comment thread docs/contribute.rst Outdated
Comment on lines +639 to +642
* ``info()`` / level 0 — key output: plan names, step names,
phase summary, overall summaries
* ``info(level=1)`` — specific info: individual test names in
``discover`` and ``execute``
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The separation between these 2 is still vague in the wording. I don't feel like I can answer yet when a potentially loggable output should be:

  • info0
  • info1
  • moved to debug
  • not logged at all

Let me give a concrete snippet

self.logger.info(f"Reading repository file from local path: {parsed_path}")
self.logger.debug(f"Absolute path of the repository file: '{parsed_path.resolve()}'")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two levels are actually described using the current tmt run behavior. Overal summaries versus listing individual tests. If you have more tangible examples at hand, please suggest them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have more tangible examples at hand, please suggest them.

What is wrong with the example snippet given above?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, example of how to better write the summary, for those two levels.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, first is the question of what to do in that example case. Because I do not know how it should be handled and as such I don't know what info0 and info1 should have

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After reading the level summaries...

 self.logger.info(f"Reading repository file from local path: {parsed_path}")

seems like this one should be log level 1

 self.logger.debug(f"Absolute path of the repository file: '{parsed_path.resolve()}'") 

This one should be debug level 2

If those choices seem wrong, then maybe the summary for those two levels could be changed 😆

Comment thread docs/contribute.rst Outdated
@psss psss added this to the 1.75 milestone Jun 2, 2026
@LecrisUT LecrisUT self-assigned this Jun 2, 2026
@psss psss force-pushed the psss-logging-and-output branch from 6f280e7 to 5c2880e Compare June 3, 2026 06:59
@psss psss requested review from LecrisUT and happz June 3, 2026 08:12
psss and others added 8 commits June 3, 2026 17:53
Add a new section defining the individual output types and individual
verbosity levels. Describes the target state to which we want to get.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Cristian Le <github@lecris.me>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@psss psss force-pushed the psss-logging-and-output branch from e2aa8e1 to c31c597 Compare June 3, 2026 15:54
Comment thread docs/contribute.rst
Comment on lines +601 to +602
method. Output represents the actual data result of a command —
a list of names, exported metadata, or formatted details meant
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
method. Output represents the actual data result of a command
a list of names, exported metadata, or formatted details meant
method. Output represents the actual data result of a command, such as
a list of names, exported metadata, or formatted details meant

Comment thread docs/contribute.rst
Comment on lines +592 to +598
execution. It is the primary form of communication for commands
that do not produce structured data, such as:

* ``tmt run``
* ``tmt try``
* ``tmt lint``
* ``tmt clean``
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
execution. It is the primary form of communication for commands
that do not produce structured data, such as:
* ``tmt run``
* ``tmt try``
* ``tmt lint``
* ``tmt clean``
execution. This is the main mode of communication you should use throughout the code.

Main thing here is to:

  • mention that this is the main thing to focus on
  • the developer should not have to figure out how one part of the code is used in either tmt run or tmt ls

Comment thread docs/contribute.rst Outdated
Comment on lines +639 to +642
* ``info()`` / level 0 — key output: plan names, step names,
phase summary, overall summaries
* ``info(level=1)`` — specific info: individual test names in
``discover`` and ``execute``
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, first is the question of what to do in that example case. Because I do not know how it should be handled and as such I don't know what info0 and info1 should have

Comment thread docs/contribute.rst
Comment on lines +778 to +779
when the topic is explicitly enabled. The following topics are
available:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would leave out the enumeration of topics. It's a recipe for divergence. Instead we can add docstrings to log.Topic if needed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these are moved to log.Topic as docstrings, having a link to the docstrings here would be very helpful

@therazix therazix removed this from the 1.75 milestone Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area | contribute Improving experience for tmt contributors code | logging Changes related to debug logging documentation Improvements or additions to documentation

Projects

Status: review

Development

Successfully merging this pull request may close these issues.

Verbosity and debug level guidelines

5 participants