Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

#1544 Changed the daemon output from json to text #1570

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

Merged
kittaakos merged 1 commit into main from #1544
Oct 24, 2022
Merged

#1544 Changed the daemon output from json to text #1570

kittaakos merged 1 commit into main from #1544
Oct 24, 2022

Conversation

Copy link
Contributor

@kittaakos kittaakos commented Oct 20, 2022

Motivation

To avoid encoding text to JSON on the CLI side.

Change description

Dropped the --log-format json options from the daemon spawn args.

Other information

Closes #1544

Reviewer checklist

  • PR addresses a single concern.
  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • PR title and description are properly filled.
  • Docs have been added / updated (for bug fixes / features)

Closes #1544
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
@kittaakos kittaakos added type: enhancement Proposed improvement topic: code Related to content of the project itself topic: CLI Related to Arduino CLI labels Oct 20, 2022
Copy link
Contributor

Should the code in the test file needs to be modified? It still allows json as logFormat.

protected override async getSpawnArgs(): Promise<string[]> {
const cliConfigPath = await this.initCliConfig();
return [
'daemon',
'--format',
'jsonmini',
'--port',
'0',
'--config-file',
cliConfigPath,
'-v',
'--log-format',
this.logFormat,
];
}

Copy link
Contributor

@AlbyIanna AlbyIanna left a comment

Choose a reason for hiding this comment

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

Looking good!

The output is also more readable IMO
from:

daemon INFO {"level":"info","msg":"Required tool","time":"2022-10-21T10:31:19+02:00","tool":{"ToolName":"arduinoOTA","ToolVersion":"1.2.1","ToolPackager":"arduino"}}
{"level":"info","msg":"Required tool","time":"2022-10-21T10:31:19+02:00","tool":{"ToolName":"arm-none-eabi-gcc","ToolVersion":"7-2017q4","ToolPackager":"arduino"}}
{"level":"info","msg":"Required tool","time":"2022-10-21T10:31:19+02:00","tool":{"ToolName":"bossac","ToolVersion":"1.7.0-arduino3","ToolPackager":"arduino"}}
{"level":"info","msg":"Required tool","time":"2022-10-21T10:31:19+02:00","tool":{"ToolName":"openocd","ToolVersion":"0.10.0-arduino7","ToolPackager":"arduino"}}

to:

daemon INFO INFO[0009] Searching tools required for board arduino:samd:mkrwifi1010 
INFO[0009] Required tool tool="arduino:CMSIS@4.5.0"
INFO[0009] Required tool tool="arduino:CMSIS-Atmel@1.2.0"
INFO[0009] Required tool tool="arduino:arduinoOTA@1.2.1"
INFO[0009] Required tool tool="arduino:arm-none-eabi-gcc@7-2017q4"
INFO[0009] Required tool tool="arduino:bossac@1.7.0-arduino3"
INFO[0009] Required tool tool="arduino:openocd@0.10.0-arduino7"

About the comment from nmzaheer: yes we should probably remove that flag from the test file too – nice catch, thank you for taking the time to look into the code!
Tests aren't failing anyway, so I won't request changes (in case @kittaakos you left that flag there on purpose for some reason)

Copy link
Contributor Author

Do you want me to remove test?

Copy link
Contributor

Do you want me to remove test?

Not really. For me it's the same, it doesn't really change anything I guess.

Copy link
Contributor Author

OK. I will create a follow-up to clean up the text|json tests. There are multiple remarks:

  • initially, the CLI did not print out the daemon port, so it had to work with both json and text. That's why we had tests.
  • currently, it does not matter whether text or json is given after the --log-format because the address format is dictated by the daemon --format jsonmini|text|json flags.

Copy link
Contributor Author

Follow-up: #1576

I am proceeding with the merge.

@kittaakos kittaakos merged commit 44751c3 into main Oct 24, 2022
@kittaakos kittaakos deleted the #1544 branch October 24, 2022 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@per1234 per1234 Awaiting requested review from per1234

1 more reviewer

@AlbyIanna AlbyIanna AlbyIanna approved these changes

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
topic: CLI Related to Arduino CLI topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Start the CLI daemon without the --log-format json

AltStyle によって変換されたページ (->オリジナル) /