Add page about logging in an integration#3042
Add page about logging in an integration#3042joostlek wants to merge 4 commits intohome-assistant:masterfrom
Conversation
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds a new documentation page Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
docs/core/integration/logging.mdsidebars.js
| --- | ||
| title: "Logging" | ||
| --- | ||
| A good way to find out what is going on in the integration is having the integration log what it is doing. |
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
docs/core/integration/logging.md (1)
4-4:⚠️ Potential issue | 🟡 MinorImprove 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
📒 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. |
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Proposed change
Add page about logging in an integration
Type of change
Checklist
Additional information
Summary by CodeRabbit