Skip to content

Add Kotlin snippet for DebugLoggingPlugin - #2105

Open
happyhuman wants to merge 3 commits into
mainfrom
docs-kotlin-debug-logging-plugin
Open

Add Kotlin snippet for DebugLoggingPlugin#2105
happyhuman wants to merge 3 commits into
mainfrom
docs-kotlin-debug-logging-plugin

Conversation

@happyhuman

@happyhuman happyhuman commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

The Kotlin section of docs/observability/logging.md covered LoggingPlugin's
console output but not DebugLoggingPlugin, available since adk-kotlin
0.6.0, which records the same activity in full to a YAML file instead of
truncated console summaries.

11 added lines in each file, matching the shape of the LoggingPlugin
subsection directly above it.

Notes for reviewers

  • Transcluded, not inline. LoggingExamples.kt is already registered in
    files_to_test.txt, so unlike an inline snippet this one is genuinely
    compiled and linted by kotlin-snippets-pr-check.yaml — both steps ran on
    this PR rather than being skipped.
  • The sample sets includeSystemInstruction = false. The plugin's KDoc
    cautions that it writes raw prompts, tool arguments and session state to
    disk. I checked the upstream test
    (DebugLoggingPluginTest.includeSystemInstructionFalse_marksPresenceWithoutLeakingText)
    to confirm the flag substitutes has_system_instruction for the text rather
    than dropping the field. Defaulting the sample to the safer value seemed
    better than showing the permissive default.
  • outputPath left at its default rather than passed explicitly, so the
    snippet doesn't imply the parameter is required. The default filename
    (adk_debug.yaml) is given in the prose instead.
  • Known gap, not fixed here: adk-python ships both logging_plugin.py and
    debug_logging_plugin.py, but this page documents plugins only in the Kotlin
    section. The asymmetry predates this PR (LoggingPlugin was already
    Kotlin-only here) but this widens it — filed as logging.md documents plugins only for Kotlin, though Python ships the same ones #2106.
  • Page badge left at Kotlin v0.1.0. The page's other Kotlin snippets work
    from 0.1.0, so bumping it would imply a floor that doesn't apply to them; the
    0.6.0 requirement is stated in the prose instead.
  • DebugLoggingPlugin is in commonJvmAndroidMain, so it works on Android too
    — no platform caveat needed.

Verification

  • CI compiled and linted the changed .kt.
  • verify_snippets.py: L0/L1/L2/L3/L5/L6 pass.
  • API surface read from the adk-kotlin v0.7.0 sources and its test.

Staged:

@netlify

netlify Bot commented Aug 10, 2026

Copy link
Copy Markdown

Deploy Preview for adk-docs-preview ready!

Name Link
🔨 Latest commit 8a434b7
🔍 Latest deploy log https://app.netlify.com/projects/adk-docs-preview/deploys/6a838ef41256cb000898eb99
😎 Deploy Preview https://deploy-preview-2105--adk-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@happyhuman
happyhuman force-pushed the docs-kotlin-debug-logging-plugin branch from 4194297 to c9dd186 Compare August 10, 2026 19:27
The Kotlin logging page covered LoggingPlugin's console output but not
DebugLoggingPlugin, available since adk-kotlin 0.6.0, which records the same
activity in full to a YAML file instead of truncated console summaries. Both
plugins override the same twelve callbacks, so the difference really is only
fidelity and destination.

Transcluded from the existing LoggingExamples.kt rather than written inline,
matching the rest of the page and keeping it in the compile regression suite --
the file is already registered in files_to_test.txt.

The sample passes includeSystemInstruction = false, since the plugin's KDoc
cautions that it writes raw prompts, tool arguments and session state to disk.
Verified against the upstream test that the flag records has_system_instruction
in place of the instruction text rather than dropping the field, and the
comment names that field so it can be found in the output.

outputPath is left at its default rather than passed explicitly; the default
filename is given in the prose instead, so the snippet does not imply the
parameter is required.

Page badge left at Kotlin v0.1.0: the other snippets on the page have worked
since then, so the version requirement for this one is noted in the prose.
```

#### Full debug capture to a file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

use a tag under the header for language version support instead of the parenthetical comment "(adk-kotlin 0.6.0 and later)":

<div class="language-support-tag">
  <span class="lst-supported">Supported in ADK</span><span class="lst-kotlin">Kotlin v0.6.0</span>
</div>


#### Full debug capture to a file

To record the same activity in full, as YAML appended to `adk_debug.yaml` rather than truncated console output, use the `DebugLoggingPlugin` (adk-kotlin 0.6.0 and later):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

remove "(adk-kotlin 0.6.0 and later)" and add language tag instead

@joefernandez joefernandez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved with comment:

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.

3 participants