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

Output levels + logger output + Replaced tracer #11522

Merged
merged 14 commits into from
Jun 27, 2022

Conversation

lasote
Copy link
Contributor

@lasote lasote commented Jun 24, 2022

Changelog: Feature: Added two new arguments for all commands -v for controlling the verbosity of the output and --logger to output the contents in a json log format for log processors.

Docs: Pending (Also document: set_conan_output_level(level, activate_logger=False)

Example of output for conan install --require zlib/1.2.11@ --logger -vvv:

{"json": {"level": "TRACE", "time": "2022-06-27T07:51:43.752333+00:00", "data": {"name": "graph.load_graph", "parameters": {"profile_host": "[settings]\narch=x86_64\nbuild_type=Release\ncompiler=apple-clang\ncompiler.cppstd=gnu98\ncompiler.libcxx=libc++\ncompiler.version=13\nos=Macos\n[options]\n[tool_requires]\n[env]\n", "profile_build": "[settings]\narch=x86_64\nbuild_type=Release\ncompiler=apple-clang\ncompiler.cppstd=gnu98\ncompiler.libcxx=libc++\ncompiler.version=13\nos=Macos\n[options]\n[tool_requires]\n[env]\n", "lockfile": null, "remotes": ["conanv2: https://conanv2beta.jfrog.io/artifactory/api/conan/conan [Verify SSL: True, Enabled: True]", "conancenter: https://center.conan.io [Verify SSL: True, Enabled: True]"], "update": false, "check_update": false}, "_action": "CONAN_API"}}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:43.754864+00:00", "data": "Not found in local cache, looking in remotes..."}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:43.754960+00:00", "data": "Checking remote: conanv2"}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:44.205134+00:00", "data": {"method": "GET", "url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v1/ping", "duration": 0.4487118721008301, "headers": {"X-Client-Anonymous-Id": "**********", "X-Client-Id": "", "User-Agent": "Conan/2.0.0-dev (Darwin 21.5.0; Python 3.9.12; x86_64)"}, "_action": "REST_API_CALL"}}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:44.666971+00:00", "data": {"method": "GET", "url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v2/conans/zlib/1.2.11/_/_/latest", "duration": 0.46160888671875, "headers": {"X-Client-Anonymous-Id": "**********", "X-Client-Id": "", "User-Agent": "Conan/2.0.0-dev (Darwin 21.5.0; Python 3.9.12; x86_64)"}, "_action": "REST_API_CALL"}}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:44.668698+00:00", "data": "Trying with 'conanv2'..."}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:45.108887+00:00", "data": {"method": "GET", "url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v2/conans/zlib/1.2.11/_/_/revisions/4524fcdd41f33e8df88ece6e755a5dcc/files", "duration": 0.43569183349609375, "headers": {"X-Client-Anonymous-Id": "**********", "X-Client-Id": "", "User-Agent": "Conan/2.0.0-dev (Darwin 21.5.0; Python 3.9.12; x86_64)"}, "_action": "REST_API_CALL"}}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:45.608625+00:00", "data": {"method": "GET", "url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v2/conans/zlib/1.2.11/_/_/revisions/4524fcdd41f33e8df88ece6e755a5dcc/files/conanmanifest.txt", "duration": 0.4981241226196289, "headers": {"User-Agent": "Conan/2.0.0-dev (Darwin 21.5.0; Python 3.9.12; x86_64)"}, "_action": "REST_API_CALL"}}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:45.608747+00:00", "data": "Downloading conanmanifest.txt"}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:45.610869+00:00", "data": {"url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v2/conans/zlib/1.2.11/_/_/revisions/4524fcdd41f33e8df88ece6e755a5dcc/files/conanmanifest.txt", "duration": 0.500385046005249, "_action": "DOWNLOAD"}}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:46.043573+00:00", "data": {"method": "GET", "url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v2/conans/zlib/1.2.11/_/_/revisions/4524fcdd41f33e8df88ece6e755a5dcc/files/conanfile.py", "duration": 0.4324917793273926, "headers": {"User-Agent": "Conan/2.0.0-dev (Darwin 21.5.0; Python 3.9.12; x86_64)"}, "_action": "REST_API_CALL"}}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:46.043692+00:00", "data": "Downloading conanfile.py"}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:46.045694+00:00", "data": {"url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v2/conans/zlib/1.2.11/_/_/revisions/4524fcdd41f33e8df88ece6e755a5dcc/files/conanfile.py", "duration": 0.4346330165863037, "_action": "DOWNLOAD"}}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:46.513741+00:00", "data": {"method": "GET", "url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v2/conans/zlib/1.2.11/_/_/revisions/4524fcdd41f33e8df88ece6e755a5dcc/files/conan_export.tgz", "duration": 0.4678950309753418, "headers": {"User-Agent": "Conan/2.0.0-dev (Darwin 21.5.0; Python 3.9.12; x86_64)"}, "_action": "REST_API_CALL"}}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:46.513864+00:00", "data": "Downloading conan_export.tgz"}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:46.515899+00:00", "data": {"url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v2/conans/zlib/1.2.11/_/_/revisions/4524fcdd41f33e8df88ece6e755a5dcc/files/conan_export.tgz", "duration": 0.47006678581237793, "_action": "DOWNLOAD"}}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:47.034104+00:00", "data": {"method": "GET", "url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v2/conans/zlib/1.2.11/_/_/revisions", "duration": 0.5173289775848389, "headers": {"X-Client-Anonymous-Id": "**********", "X-Client-Id": "", "User-Agent": "Conan/2.0.0-dev (Darwin 21.5.0; Python 3.9.12; x86_64)"}, "_action": "REST_API_CALL"}}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:47.036685+00:00", "data": {"_id": "zlib/1.2.11%1650538915.154", "duration": 2.3637590408325195, "remote": "conanv2", "files": [{"name": "conan_export.tgz", "path": "/Users/luism/.conan2/p/441d73ab51bce6ae/d/conan_export.tgz", "md5": "13718a89d7bfb85106aaa8c74a72f21d", "sha1": "4d623b1c74a19ee8f2200e0a2982e853669c2b18", "type": "folder"}, {"name": "conanmanifest.txt", "path": "/Users/luism/.conan2/p/441d73ab51bce6ae/d/conanmanifest.txt", "md5": "518050541f0404508ded3cec35025b60", "sha1": "3b2de7b57dec25825898a43221fa5016e943ee28", "type": "folder"}, {"name": "conanfile.py", "path": "/Users/luism/.conan2/p/441d73ab51bce6ae/d/conanfile.py", "md5": "1279d9efbeb348bf4c7eedcf5a8fcc32", "sha1": "56d05d8c09239ef5b6238216fa8aa0386e2baff7", "type": "folder"}], "_action": "DOWNLOADED_RECIPE"}}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:47.036793+00:00", "data": "Decompressing conan_export.tgz"}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:47.037834+00:00", "data": {"src": "/Users/luism/.conan2/p/441d73ab51bce6ae/d/conan_export.tgz", "dst": "/Users/luism/.conan2/p/441d73ab51bce6ae/e", "duration": 0.0010399818420410156, "_action": "UNZIP"}}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:47.038554+00:00", "data": "Downloaded recipe revision 4524fcdd41f33e8df88ece6e755a5dcc"}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:47.044940+00:00", "data": "Graph root"}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:47.044990+00:00", "data": "    virtual"}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:47.045019+00:00", "data": "Requirements"}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:47.045050+00:00", "data": "    zlib/1.2.11#4524fcdd41f33e8df88ece6e755a5dcc - Downloaded (conanv2)"}}
{"json": {"level": "NOTICE", "time": "2022-06-27T07:51:47.045077+00:00", "data": "-------- Computing necessary packages ----------"}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:47.045168+00:00", "data": {"name": "graph.analyze_binaries", "parameters": {"remotes": ["conanv2: https://conanv2beta.jfrog.io/artifactory/api/conan/conan [Verify SSL: True, Enabled: True]", "conancenter: https://center.conan.io [Verify SSL: True, Enabled: True]"], "update": false, "lockfile": null}, "_action": "CONAN_API"}}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:47.448371+00:00", "data": {"method": "GET", "url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v1/ping", "duration": 0.3968780040740967, "headers": {"X-Client-Anonymous-Id": "**********", "X-Client-Id": "", "User-Agent": "Conan/2.0.0-dev (Darwin 21.5.0; Python 3.9.12; x86_64)"}, "_action": "REST_API_CALL"}}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:47.886787+00:00", "data": {"method": "GET", "url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v2/conans/zlib/1.2.11/_/_/revisions/4524fcdd41f33e8df88ece6e755a5dcc/packages/d62dff20d86436b9c58ddc0162499d197be9de1e/latest", "duration": 0.4382143020629883, "headers": {"X-Client-Anonymous-Id": "**********", "X-Client-Id": "", "User-Agent": "Conan/2.0.0-dev (Darwin 21.5.0; Python 3.9.12; x86_64)"}, "_action": "REST_API_CALL"}}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:47.887985+00:00", "data": "Requirements"}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:47.888047+00:00", "data": "    zlib/1.2.11#4524fcdd41f33e8df88ece6e755a5dcc:d62dff20d86436b9c58ddc0162499d197be9de1e#3a93a98a2e86fbb87c6da2844cfda7a6 - Download (conanv2)"}}
{"json": {"level": "NOTICE", "time": "2022-06-27T07:51:47.888134+00:00", "data": "-------- Installing packages ----------"}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:47.888224+00:00", "data": {"name": "install.install_binaries", "parameters": {"deps_graph": "virtual\nzlib/1.2.11", "remotes": ["conanv2: https://conanv2beta.jfrog.io/artifactory/api/conan/conan [Verify SSL: True, Enabled: True]", "conancenter: https://center.conan.io [Verify SSL: True, Enabled: True]"], "update": false}, "_action": "CONAN_API"}}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:47.889757+00:00", "data": "Installing (downloading, building) binaries..."}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:47.889859+00:00", "data": "Retrieving package d62dff20d86436b9c58ddc0162499d197be9de1e from remote 'conanv2' "}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:48.278211+00:00", "data": {"method": "GET", "url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v1/ping", "duration": 0.38638806343078613, "headers": {"X-Client-Anonymous-Id": "**********", "X-Client-Id": "", "User-Agent": "Conan/2.0.0-dev (Darwin 21.5.0; Python 3.9.12; x86_64)"}, "_action": "REST_API_CALL"}}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:48.710981+00:00", "data": {"method": "GET", "url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v2/conans/zlib/1.2.11/_/_/revisions/4524fcdd41f33e8df88ece6e755a5dcc/packages/d62dff20d86436b9c58ddc0162499d197be9de1e/revisions/3a93a98a2e86fbb87c6da2844cfda7a6/files", "duration": 0.4325389862060547, "headers": {"X-Client-Anonymous-Id": "**********", "X-Client-Id": "", "User-Agent": "Conan/2.0.0-dev (Darwin 21.5.0; Python 3.9.12; x86_64)"}, "_action": "REST_API_CALL"}}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:49.147595+00:00", "data": {"method": "GET", "url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v2/conans/zlib/1.2.11/_/_/revisions/4524fcdd41f33e8df88ece6e755a5dcc/packages/d62dff20d86436b9c58ddc0162499d197be9de1e/revisions/3a93a98a2e86fbb87c6da2844cfda7a6/files/conanmanifest.txt", "duration": 0.43471193313598633, "headers": {"User-Agent": "Conan/2.0.0-dev (Darwin 21.5.0; Python 3.9.12; x86_64)"}, "_action": "REST_API_CALL"}}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:49.147719+00:00", "data": "Downloading conanmanifest.txt"}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:49.149909+00:00", "data": {"url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v2/conans/zlib/1.2.11/_/_/revisions/4524fcdd41f33e8df88ece6e755a5dcc/packages/d62dff20d86436b9c58ddc0162499d197be9de1e/revisions/3a93a98a2e86fbb87c6da2844cfda7a6/files/conanmanifest.txt", "duration": 0.4370460510253906, "_action": "DOWNLOAD"}}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:49.585127+00:00", "data": {"method": "GET", "url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v2/conans/zlib/1.2.11/_/_/revisions/4524fcdd41f33e8df88ece6e755a5dcc/packages/d62dff20d86436b9c58ddc0162499d197be9de1e/revisions/3a93a98a2e86fbb87c6da2844cfda7a6/files/conaninfo.txt", "duration": 0.4350409507751465, "headers": {"User-Agent": "Conan/2.0.0-dev (Darwin 21.5.0; Python 3.9.12; x86_64)"}, "_action": "REST_API_CALL"}}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:49.585252+00:00", "data": "Downloading conaninfo.txt"}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:49.587116+00:00", "data": {"url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v2/conans/zlib/1.2.11/_/_/revisions/4524fcdd41f33e8df88ece6e755a5dcc/packages/d62dff20d86436b9c58ddc0162499d197be9de1e/revisions/3a93a98a2e86fbb87c6da2844cfda7a6/files/conaninfo.txt", "duration": 0.43705010414123535, "_action": "DOWNLOAD"}}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:50.064365+00:00", "data": {"method": "GET", "url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v2/conans/zlib/1.2.11/_/_/revisions/4524fcdd41f33e8df88ece6e755a5dcc/packages/d62dff20d86436b9c58ddc0162499d197be9de1e/revisions/3a93a98a2e86fbb87c6da2844cfda7a6/files/conan_package.tgz", "duration": 0.4770939350128174, "headers": {"User-Agent": "Conan/2.0.0-dev (Darwin 21.5.0; Python 3.9.12; x86_64)"}, "_action": "REST_API_CALL"}}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:50.064484+00:00", "data": "Downloading conan_package.tgz"}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:50.265380+00:00", "data": {"url": "https://conanv2beta.jfrog.io/artifactory/api/conan/conan/v2/conans/zlib/1.2.11/_/_/revisions/4524fcdd41f33e8df88ece6e755a5dcc/packages/d62dff20d86436b9c58ddc0162499d197be9de1e/revisions/3a93a98a2e86fbb87c6da2844cfda7a6/files/conan_package.tgz", "duration": 0.6781148910522461, "_action": "DOWNLOAD"}}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:50.266615+00:00", "data": {"_id": "zlib/1.2.11#4524fcdd41f33e8df88ece6e755a5dcc%1650538915.154:d62dff20d86436b9c58ddc0162499d197be9de1e%1655310080.729", "duration": 2.3741817474365234, "remote": "conanv2", "files": [{"name": "conaninfo.txt", "path": "/Users/luism/.conan2/p/ae937a7d87dae093/d/conaninfo.txt", "md5": "1711cf1d1b9b7a0bb3356ed9c8d3fef5", "sha1": "d62dff20d86436b9c58ddc0162499d197be9de1e", "type": "folder"}, {"name": "conan_package.tgz", "path": "/Users/luism/.conan2/p/ae937a7d87dae093/d/conan_package.tgz", "md5": "8ddd57c5987dab80915e5a5ab6430291", "sha1": "63e5bbb207d00f4e8fe2374451faa00bc7db5cf2", "type": "folder"}, {"name": "conanmanifest.txt", "path": "/Users/luism/.conan2/p/ae937a7d87dae093/d/conanmanifest.txt", "md5": "1ffd29fce8db3b59a79d7431b563abf6", "sha1": "efc3364680f2624ff8e447d4dbd53e2382ac1bf2", "type": "folder"}], "_action": "DOWNLOADED_PACKAGE"}}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:50.266714+00:00", "data": "Decompressing conan_package.tgz"}}
{"json": {"level": "TRACE", "time": "2022-06-27T07:51:50.271267+00:00", "data": {"src": "/Users/luism/.conan2/p/ae937a7d87dae093/d/conan_package.tgz", "dst": "/Users/luism/.conan2/p/ae937a7d87dae093/p", "duration": 0.004552125930786133, "_action": "UNZIP"}}}
{"json": {"level": "NOTICE", "time": "2022-06-27T07:51:50.271979+00:00", "data": "Package installed d62dff20d86436b9c58ddc0162499d197be9de1e"}}
{"json": {"level": "STATUS", "time": "2022-06-27T07:51:50.272024+00:00", "data": "Downloaded package revision 3a93a98a2e86fbb87c6da2844cfda7a6"}}
{"json": {"level": "NOTICE", "time": "2022-06-27T07:51:50.272958+00:00", "data": "-------- Finalizing install (deploy, generators) ----------"}}
{"json": {"level": "NOTICE", "time": "2022-06-27T07:51:50.274160+00:00", "data": "Aggregating env generators"}}

@lasote lasote added this to the 2.0.0-beta2 milestone Jun 24, 2022
@lasote lasote requested review from czoido and memsharded June 24, 2022 10:52
conans/cli/commands/__init__.py Outdated Show resolved Hide resolved
conans/cli/output.py Outdated Show resolved Hide resolved
conan/tools/cmake/cmake.py Outdated Show resolved Hide resolved
Copy link
Member

@memsharded memsharded 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

conans/cli/commands/build.py Outdated Show resolved Hide resolved
conans/cli/output.py Show resolved Hide resolved
conans/client/rest/conan_requester.py Outdated Show resolved Hide resolved
conans/util/tracer.py Show resolved Hide resolved
@lasote lasote changed the title POC output levels Output levels + logger output + Replaced tracer Jun 27, 2022
@lasote lasote marked this pull request as ready for review June 27, 2022 10:12
Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

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

Looking very good

conans/client/installer.py Outdated Show resolved Hide resolved
conans/cli/command.py Show resolved Hide resolved
@memsharded memsharded requested a review from czoido June 27, 2022 10:32
Co-authored-by: James <james@conan.io>
Copy link
Contributor

@czoido czoido left a comment

Choose a reason for hiding this comment

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

Just a couple of comments

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