Skip to content

Commit c680cab

Browse files
authored
Merge branch 'main' into GkeDeployAgent
2 parents c829547 + 3be0882 commit c680cab

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/google/adk/cli/cli_tools_click.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from typing import Optional
2626

2727
import click
28+
from click.core import ParameterSource
2829
from fastapi import FastAPI
2930
import uvicorn
3031

@@ -557,6 +558,14 @@ def decorator(func):
557558
help="Optional. Any additional origins to allow for CORS.",
558559
multiple=True,
559560
)
561+
@click.option(
562+
"-v",
563+
"--verbose",
564+
is_flag=True,
565+
show_default=True,
566+
default=False,
567+
help="Enable verbose (DEBUG) logging. Shortcut for --log_level DEBUG.",
568+
)
560569
@click.option(
561570
"--log_level",
562571
type=LOG_LEVELS,
@@ -593,7 +602,16 @@ def decorator(func):
593602
help="Optional. Whether to enable live reload for agents changes.",
594603
)
595604
@functools.wraps(func)
596-
def wrapper(*args, **kwargs):
605+
@click.pass_context
606+
def wrapper(ctx, *args, **kwargs):
607+
# If verbose flag is set and log level is not set, set log level to DEBUG.
608+
log_level_source = ctx.get_parameter_source("log_level")
609+
if (
610+
kwargs.pop("verbose", False)
611+
and log_level_source == ParameterSource.DEFAULT
612+
):
613+
kwargs["log_level"] = "DEBUG"
614+
597615
return func(*args, **kwargs)
598616

599617
return wrapper

0 commit comments

Comments
 (0)