From c18bb951671e492206c7a3bcfcdece9a2ce401ae Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Oct 2025 12:44:14 +0000 Subject: [PATCH 1/2] Initial plan From 2fa7757cb61c2d39d70922197d235127afcc0c1e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Oct 2025 12:53:01 +0000 Subject: [PATCH 2/2] Update AGENTS.md with comprehensive DEBUG pattern documentation Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- AGENTS.md | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index c79de2d749c..34199180e66 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -128,23 +128,48 @@ if log.Enabled() { - Be consistent with existing loggers in the codebase **Debug Output Control:** + +The `DEBUG` environment variable supports flexible pattern matching to control which loggers are enabled. + ```bash # Enable all debug logs DEBUG=* gh aw compile -# Enable specific package +# Enable specific package (prefix wildcard) DEBUG=cli:* gh aw compile -# Enable multiple packages +# Enable exact namespace (no wildcard) +DEBUG=cli:compile_command gh aw compile + +# Enable all loggers ending with specific suffix (suffix wildcard) +DEBUG=*:compiler gh aw compile + +# Enable with prefix and suffix match (middle wildcard) +DEBUG=cli:*:command gh aw compile + +# Enable multiple packages (comma-separated, spaces are trimmed) DEBUG=cli:*,workflow:* gh aw compile +DEBUG="cli:* , workflow:*" gh aw compile # spaces require quotes -# Exclude specific loggers +# Exclude specific loggers (exclusions take precedence) DEBUG=*,-workflow:test gh aw compile -# Disable colors (auto-disabled when piping) +# Exclude entire namespace +DEBUG=*,-cli:* gh aw compile + +# Disable colors (auto-disabled when piping to files/commands) DEBUG_COLORS=0 DEBUG=* gh aw compile ``` +**Pattern Matching Rules:** +- `*` matches all loggers +- `namespace:*` matches all loggers with the given prefix (e.g., `cli:*` matches `cli:compile`, `cli:logs`, etc.) +- `*:suffix` matches all loggers ending with the suffix (e.g., `*:compiler` matches `workflow:compiler`, `cli:compiler`) +- `prefix:*:suffix` matches loggers with both prefix and suffix (e.g., `cli:*:command`) +- `exact:match` matches only the exact namespace (e.g., `cli:compile_command`) +- `-pattern` excludes loggers matching the pattern (exclusions take precedence over inclusions) +- Patterns can be combined with commas, and spaces around commas are trimmed + **Key Features:** - **Zero overhead**: Logs only computed when DEBUG matches the logger's namespace - **Time diff**: Shows elapsed time between log calls (e.g., `+50ms`, `+2.5s`)