Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature mute stream log for info level #1124

Merged
merged 3 commits into from
Apr 5, 2024

Conversation

azurewtl
Copy link
Contributor

Features
see issue : #1109
llm stream_response alway been print regardless of debug flag
I modified logs.py rather than config2.py.
This is because log is been set via define_log_level rather than config.yaml
To keep things simple, a global variable _print_level is introduced in logs.py

Influence
define_log_level(print_level="INFO") will mute log_llm_stream

metagpt/logs.py Outdated Show resolved Hide resolved
@shenchucheng
Copy link
Collaborator

@azurewtl Thanks for your improvements. It works when I call define_log_level(print_level="DEBUG") in my Python script entry if I want to print the LLM stream log. However, I'm considering whether to provide a simpler way to set it up, perhaps by passing environment variables METAGPT_LOG_PRINT_LEVEL and METAGPT_LOG_FILE_LEVEL?

@azurewtl
Copy link
Contributor Author

@azurewtl Thanks for your improvements. It works when I call define_log_level(print_level="DEBUG") in my Python script entry if I want to print the LLM stream log. However, I'm considering whether to provide a simpler way to set it up, perhaps by passing environment variables METAGPT_LOG_PRINT_LEVEL and METAGPT_LOG_FILE_LEVEL?

I thought about using config. however, my proposal is that debug flag should be pass via command line tools.
Oftentimes, If we want to see debug info during development, I run program and pass debug flag such as:

python run.py --debug

Maybe YAML better off storage config that is NOT changed on ad-hoc basis. Otherwise if I want to show less or more info, I need to change config frequently.

@geekan
Copy link
Owner

geekan commented Mar 28, 2024

@shenchucheng I think this is a new requirement and can be discussed additionally. This PR can be merged first
@azurewtl If there are new changes, submit another PR

@@ -14,9 +14,13 @@

from metagpt.const import METAGPT_ROOT

_print_level = "INFO"
Copy link
Owner

@geekan geekan Mar 28, 2024

Choose a reason for hiding this comment

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

DEBUG should be used for default _print_level?

@geekan
Copy link
Owner

geekan commented Apr 5, 2024

Anyway, I’ll merge first

@geekan geekan merged commit c6766e8 into geekan:main Apr 5, 2024
0 of 3 checks passed
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