Skip to content

Add page about logging in an integration#3042

Draft
joostlek wants to merge 4 commits intohome-assistant:masterfrom
joostlek:logging
Draft

Add page about logging in an integration#3042
joostlek wants to merge 4 commits intohome-assistant:masterfrom
joostlek:logging

Conversation

@joostlek
Copy link
Copy Markdown
Member

@joostlek joostlek commented Apr 8, 2026

Proposed change

Add page about logging in an integration

Type of change

  • Document existing features within Home Assistant
  • Document new or changing features for which there is an existing pull request elsewhere
  • Spelling or grammatical corrections, or rewording for improved clarity
  • Changes to the backend of this documentation
  • Remove stale or deprecated documentation

Checklist

  • I have read and followed the documentation guidelines.
  • I have verified that my changes render correctly in the documentation.

Additional information

  • This PR fixes or closes issue: fixes #
  • Link to relevant existing code or pull request:

Summary by CodeRabbit

  • Documentation
    • New integration logging guide added: explains how to enable debug logging, example configurations, and options to target specific modules.
    • Guidance on avoiding log spam and sensitive data exposure included.
    • Guide now appears in the "Debugging an integration" section for easier discovery.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

Warning

Rate limit exceeded

@joostlek has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 19 minutes and 55 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 19 minutes and 55 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cbeff936-aea4-48a0-be43-944cbfbb4f4e

📥 Commits

Reviewing files that changed from the base of the PR and between bebe1b4 and f6f4202.

📒 Files selected for processing (2)
  • docs/core/integration/logging.md
  • sidebars.js
📝 Walkthrough

Walkthrough

Adds a new documentation page docs/core/integration/logging.md describing integration debug logging behavior, configuration examples, and warnings about noise and sensitive data; updates sidebars.js to surface the new page under the "Debugging an integration" sidebar category.

Changes

Cohort / File(s) Summary
Documentation
docs/core/integration/logging.md
New integration logging doc explaining how debug logging is applied to integration and manifest-declared modules, includes JSON example, and warnings about log noise and sensitive data.
Sidebar update
sidebars.js
Added core/integration/logging to the "Debugging an integration" category items so the new page appears in navigation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely incomplete. While it fills in the proposed change and selects the type-of-change checkbox, it leaves critical sections empty: the checklist items are unchecked and the additional information section lacks required links to relevant code or issues. Check the documentation-guidelines and render-verification checklist boxes to confirm completion of required steps. Add links to relevant code or related pull requests in the additional information section to provide context for reviewers.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title clearly and concisely summarizes the main change: adding a new documentation page about logging in integrations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/core/integration/logging.md`:
- Line 4: Replace the awkward intro sentence "A good way to find out what is
going on in the integration is having the integration log what it is doing."
with a clearer phrasing such as "A good way to find out what is going on in an
integration is to have it log what it is doing." Ensure the updated sentence
appears at the top of the document (the integration logging introduction) and
preserves original meaning and tone.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 62db515e-f302-4820-b118-701c2a71beec

📥 Commits

Reviewing files that changed from the base of the PR and between fe301e9 and c3c9fda.

📒 Files selected for processing (2)
  • docs/core/integration/logging.md
  • sidebars.js

Comment thread docs/core/integration/logging.md Outdated
Comment thread docs/core/integration/logging.md Outdated
---
title: "Logging"
---
A good way to find out what is going on in the integration is having the integration log what it is doing.
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 am wondering if we actually have some best practices to share with developers, as today it's more like "we don't like it if you log everything, is it really needed?" and "don't spam"

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
docs/core/integration/logging.md (1)

4-4: ⚠️ Potential issue | 🟡 Minor

Improve intro sentence grammar for clarity.

The phrasing "is having the integration log" is awkward and non-idiomatic. Suggest rewriting to "is to have the integration log" or "is to make the integration log" for better readability.

📝 Suggested fix
-A good way to find out what is going on in the integration is having the integration log what it is doing.
+A good way to find out what is going on in an integration is to have it log what it is doing.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/core/integration/logging.md` at line 4, Replace the awkward intro
sentence "A good way to find out what is going on in the integration is having
the integration log what it is doing." with a clearer phrasing such as "A good
way to find out what is going on in the integration is to have the integration
log what it is doing." (or "is to make the integration log what it is doing") in
docs/core/integration/logging.md so the sentence reads idiomatically and
improves readability.
🧹 Nitpick comments (2)
docs/core/integration/logging.md (2)

16-16: Clarify "integration manifest" for precision.

The phrase "the following integration" could be more precise as "the following integration manifest" to clarify that you're showing the manifest JSON structure.

📝 Optional refinement
-So when debug logging is enabled for the following integration, it will set the log level to debug for both the `my_integration` and `dependency` modules:
+So when debug logging is enabled for the following integration manifest, it will set the log level to debug for both the `my_integration` and `dependency` modules:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/core/integration/logging.md` at line 16, Replace the ambiguous phrase
"the following integration" with "the following integration manifest" in the
sentence that reads "So when debug logging is enabled for the following
integration, it will set the log level to debug for both the `my_integration`
and `dependency` modules" so the docs clearly indicate you're showing the
manifest JSON structure; update that sentence to: "So when debug logging is
enabled for the following integration manifest, it will set the log level..."
and ensure surrounding context still refers to the manifest example.

7-7: Consider using "ensure" for more formal tone.

The phrase "make sure" could be replaced with "ensure" for a slightly more formal documentation tone, though both are acceptable.

📝 Optional refinement
-Please make sure not to spam the logs, as that will make it harder to find the relevant information and may cause performance issues.
+Please ensure not to spam the logs, as that will make it harder to find the relevant information and may cause performance issues.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/core/integration/logging.md` at line 7, Replace the phrase "Please make
sure not to spam the logs, as that will make it harder to find the relevant
information and may cause performance issues." by using "ensure" for a more
formal tone (e.g., "Please ensure you do not spam the logs, as that will make it
harder to find the relevant information and may cause performance issues."),
updating the exact sentence string in docs/core/integration/logging.md.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/core/integration/logging.md`:
- Line 14: Update the sentence to use plural "modules": change "Enabling debug
logging will set the log level for the integration module and for the module
declared in the manifest to debug." to refer to "the integration module and the
modules declared in the manifest" (or similar plural phrasing) so it accurately
reflects that the manifest's loggers field can contain multiple module names.

---

Duplicate comments:
In `@docs/core/integration/logging.md`:
- Line 4: Replace the awkward intro sentence "A good way to find out what is
going on in the integration is having the integration log what it is doing."
with a clearer phrasing such as "A good way to find out what is going on in the
integration is to have the integration log what it is doing." (or "is to make
the integration log what it is doing") in docs/core/integration/logging.md so
the sentence reads idiomatically and improves readability.

---

Nitpick comments:
In `@docs/core/integration/logging.md`:
- Line 16: Replace the ambiguous phrase "the following integration" with "the
following integration manifest" in the sentence that reads "So when debug
logging is enabled for the following integration, it will set the log level to
debug for both the `my_integration` and `dependency` modules" so the docs
clearly indicate you're showing the manifest JSON structure; update that
sentence to: "So when debug logging is enabled for the following integration
manifest, it will set the log level..." and ensure surrounding context still
refers to the manifest example.
- Line 7: Replace the phrase "Please make sure not to spam the logs, as that
will make it harder to find the relevant information and may cause performance
issues." by using "ensure" for a more formal tone (e.g., "Please ensure you do
not spam the logs, as that will make it harder to find the relevant information
and may cause performance issues."), updating the exact sentence string in
docs/core/integration/logging.md.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 36e9227c-d6d0-4753-8b20-62d747a28189

📥 Commits

Reviewing files that changed from the base of the PR and between c3c9fda and bebe1b4.

📒 Files selected for processing (1)
  • docs/core/integration/logging.md


By default, Home Assistant does not log debug messages.
Debug logging can be enabled for the integration by the user as described in the [user documentation].
Enabling debug logging will set the log level for the integration module and for the module declared in the manifest to debug.
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.

⚠️ Potential issue | 🟡 Minor

Use plural "modules" for accuracy.

The phrase "the module declared in the manifest" implies a single module, but the loggers field is an array that can contain multiple module names. Use plural form for accuracy.

📝 Suggested fix
-Enabling debug logging will set the log level for the integration module and for the module declared in the manifest to debug.
+Enabling debug logging will set the log level for the integration module and for the modules listed in the manifest's `loggers` field to debug.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Enabling debug logging will set the log level for the integration module and for the module declared in the manifest to debug.
Enabling debug logging will set the log level for the integration module and for the modules listed in the manifest's `loggers` field to debug.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/core/integration/logging.md` at line 14, Update the sentence to use
plural "modules": change "Enabling debug logging will set the log level for the
integration module and for the module declared in the manifest to debug." to
refer to "the integration module and the modules declared in the manifest" (or
similar plural phrasing) so it accurately reflects that the manifest's loggers
field can contain multiple module names.

Please make sure not to spam the logs, as that will make it harder to find the relevant information and may cause performance issues.
:::

## Debug logging
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.

I would suggest rewording this section to be about "dependency logging", since it is not about debug logs only.
If the user has set the default logging to error and then sets it to info for the integration, this will also log info logs for the things listed in loggers, right?

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.

Well it's not only about dependencies, because it's about how logging is enabled for both the integration module and the dependency.

You can't set the logging for an integration to info, if you do that via the logging module, I believe it literally only does that for that module, so it's not looking at "oh you log homeassistant.components.smartthings, let me also set pysmartthings to the same level"


## Debug logging

By default, Home Assistant does not log debug messages.
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.

maybe reword this to something like "In order to enable additional modules logged when the user enables logs for an integration, set the modules i the loggers key of the manifest".
that way we make it clearer what we are discussing here, and focused on development and not how the user enables them.

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 think I started this paragraph more explaining what debug logs are and how they can help the developer with diagnosing issues. That was my goal at least. So more of a, this is debug logging, a non-intrusive way of fetching a stream of information on demand, and this is how the user enables it and what shouldn't be logged.

Not saying that your suggestion is bad, more trying to explain my thought process behind it

@home-assistant
Copy link
Copy Markdown

home-assistant bot commented Apr 8, 2026

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft April 8, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants