Skip to content

Commit d938ff0

Browse files
authored
Merge pull request #1667 from jmrtnz94/1592_ENVLogLevel
Update logging configuration to use dynamic log level from settings
2 parents 1ffddaf + 76b447a commit d938ff0

8 files changed

+19
-6
lines changed

docs/docs/usage-guide/additional_configurations.md

+11
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,17 @@ user="""
139139
```
140140
Note that the new prompt will need to generate an output compatible with the relevant [post-process function](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/tools/pr_description.py#L137).
141141

142+
## Log Level
143+
144+
Qodo Merge allows you to control the verbosity of logging by using the `log_level` configuration parameter. This is particularly useful for troubleshooting and debugging issues with your PR workflows.
145+
146+
```
147+
[config]
148+
log_level = "DEBUG" # Options: "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"
149+
```
150+
151+
The default log level is "DEBUG", which provides detailed output of all operations. If you prefer less verbose logs, you can set higher log levels like "INFO" or "WARNING".
152+
142153
## Integrating with Logging Observability Platforms
143154

144155
Various logging observability tools can be used out-of-the box when using the default LiteLLM AI Handler. Simply configure the LiteLLM callback settings in `configuration.toml` and set environment variables according to the LiteLLM [documentation](https://docs.litellm.ai/docs/).

pr_agent/servers/azuredevops_server_webhook.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from pr_agent.git_providers.utils import apply_repo_settings
2626
from pr_agent.log import LoggingFormat, get_logger, setup_logger
2727

28-
setup_logger(fmt=LoggingFormat.JSON, level="DEBUG")
28+
setup_logger(fmt=LoggingFormat.JSON, level=get_settings().get("CONFIG.LOG_LEVEL", "DEBUG"))
2929
security = HTTPBasic()
3030
router = APIRouter()
3131
available_commands_rgx = re.compile(r"^\/(" + "|".join(command2class.keys()) + r")\s*")

pr_agent/servers/bitbucket_app.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from pr_agent.log import LoggingFormat, get_logger, setup_logger
2626
from pr_agent.secret_providers import get_secret_provider
2727

28-
setup_logger(fmt=LoggingFormat.JSON, level="DEBUG")
28+
setup_logger(fmt=LoggingFormat.JSON, level=get_settings().get("CONFIG.LOG_LEVEL", "DEBUG"))
2929
router = APIRouter()
3030
secret_provider = get_secret_provider() if get_settings().get("CONFIG.SECRET_PROVIDER") else None
3131

pr_agent/servers/bitbucket_server_webhook.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from pr_agent.log import LoggingFormat, get_logger, setup_logger
2222
from pr_agent.servers.utils import verify_signature
2323

24-
setup_logger(fmt=LoggingFormat.JSON, level="DEBUG")
24+
setup_logger(fmt=LoggingFormat.JSON, level=get_settings().get("CONFIG.LOG_LEVEL", "DEBUG"))
2525
router = APIRouter()
2626

2727

pr_agent/servers/github_app.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from pr_agent.log import LoggingFormat, get_logger, setup_logger
2525
from pr_agent.servers.utils import DefaultDictWithTimeout, verify_signature
2626

27-
setup_logger(fmt=LoggingFormat.JSON, level="DEBUG")
27+
setup_logger(fmt=LoggingFormat.JSON, level=get_settings().get("CONFIG.LOG_LEVEL", "DEBUG"))
2828
base_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
2929
build_number_path = os.path.join(base_path, "build_number.txt")
3030
if os.path.exists(build_number_path):

pr_agent/servers/github_polling.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from pr_agent.git_providers import get_git_provider
1414
from pr_agent.log import LoggingFormat, get_logger, setup_logger
1515

16-
setup_logger(fmt=LoggingFormat.JSON, level="DEBUG")
16+
setup_logger(fmt=LoggingFormat.JSON, level=get_settings().get("CONFIG.LOG_LEVEL", "DEBUG"))
1717
NOTIFICATION_URL = "https://api.github.com/notifications"
1818

1919

pr_agent/servers/gitlab_webhook.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from pr_agent.log import LoggingFormat, get_logger, setup_logger
2020
from pr_agent.secret_providers import get_secret_provider
2121

22-
setup_logger(fmt=LoggingFormat.JSON, level="DEBUG")
22+
setup_logger(fmt=LoggingFormat.JSON, level=get_settings().get("CONFIG.LOG_LEVEL", "DEBUG"))
2323
router = APIRouter()
2424

2525
secret_provider = get_secret_provider() if get_settings().get("CONFIG.SECRET_PROVIDER") else None

pr_agent/settings/configuration.toml

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ publish_output=true
1515
publish_output_progress=true
1616
verbosity_level=0 # 0,1,2
1717
use_extra_bad_extensions=false
18+
# Log
19+
log_level="DEBUG"
1820
# Configurations
1921
use_wiki_settings_file=true
2022
use_repo_settings_file=true

0 commit comments

Comments
 (0)