Skip to content

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

Closed
@kittaakos

Description

@kittaakos

Describe the request

The daemon logging is essential in IDE2, but the JSON format adds an unnecessary computation; at least the JSON encoding phase is there. If this means only milliseconds of improvement, it will eventually add up.

Consider starting the daemon without the JSON log format.

diff --git a/arduino-ide-extension/src/node/arduino-daemon-impl.ts b/arduino-ide-extension/src/node/arduino-daemon-impl.ts
index f859985e..4a3ad882 100644
--- a/arduino-ide-extension/src/node/arduino-daemon-impl.ts
+++ b/arduino-ide-extension/src/node/arduino-daemon-impl.ts
@@ -162,8 +162,6 @@ export class ArduinoDaemonImpl
       '--config-file',
       `"${cliConfigPath}"`,
       '-v',
-      '--log-format',
-      'json',
     ];
     if (debug) {
       args.push('--debug');

With the proposed changes 👆, the daemon log output would be this:

time="2022-10-07T11:27:08+02:00" level=debug msg="Checking previous results for /Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino/HardwareSerial1.cpp (result = /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-language-server2174793569/core/HardwareSerial1.cpp.o, dep = /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-language-server2174793569/core/HardwareSerial1.cpp.d)"

instead of this:

{"level":"debug","msg":"Checking previous results for /Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino/HardwareSerial1.cpp (result = /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-language-server1238442199/core/HardwareSerial1.cpp.o, dep = /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-language-server1238442199/core/HardwareSerial1.cpp.d)","time":"2022-10-07T11:47:48+02:00"}

I believe both log formats are equally OK to consume, but the non-JSON one is cheaper.

Describe the current behavior

See the request description.

Arduino IDE version

1e269ac

Operating system

macOS

Operating system version

12.5.1

Additional context

No response

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the latest nightly build
  • My request contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: CLIRelated to Arduino CLItopic: codeRelated to content of the project itselftype: enhancementProposed improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions