Skip to content

Commit 47f690d

Browse files
authored
[SDK generation pipeline] optimize log (#36922)
* optimize log * optimize log * format
1 parent 25fea1d commit 47f690d

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

tools/azure-sdk-tools/packaging_tools/generate_utils.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from contextlib import suppress
21
import json
32
import logging
43
import os
@@ -434,7 +433,11 @@ def gen_typespec(typespec_relative_path: str, spec_folder: str, head_sha: str, r
434433
_LOGGER.info(f"generation cmd: {cmd}")
435434
output = check_output(cmd, stderr=STDOUT, shell=True)
436435
except CalledProcessError as e:
437-
_LOGGER.error(f"Failed to generate sdk from typespec: {e.output.decode('utf-8')}")
436+
_LOGGER.error("Error occurred when call tsp-client:")
437+
for item in e.output.decode("utf-8").split("\n"):
438+
if "Error: " in item:
439+
_LOGGER.error(item)
440+
_LOGGER.info(f"whole output when fail to call tsp-client: {e.output.decode('utf-8')}")
438441
raise e
439442

440443
decode_output = output.decode("utf-8")
@@ -444,7 +447,7 @@ def gen_typespec(typespec_relative_path: str, spec_folder: str, head_sha: str, r
444447
for item in decode_output.split("\n"):
445448
if " - error " in item:
446449
_LOGGER.error(item)
447-
raise Exception(f"Failed to generate sdk from typespec: {decode_output}")
450+
raise Exception(f"Complete output when fail to generate sdk from typespec: {decode_output}")
448451

449452
with open(Path("eng/emitter-package.json"), "r") as file_in:
450453
data = json.load(file_in)

tools/azure-sdk-tools/packaging_tools/package_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def change_log_new(package_folder: str, lastest_pypi_version: bool) -> str:
2828
try:
2929
output = check_output(cmd, cwd=package_folder, shell=True)
3030
except CalledProcessError as e:
31-
_LOGGER.warning(f"Failed to generate sdk from typespec: {e.output.decode('utf-8')}")
31+
_LOGGER.warning(f"Error ocurred when call breaking change detector: {e.output.decode('utf-8')}")
3232
raise e
3333
result = [l for l in output.decode("utf-8").split(os.linesep)]
3434
begin = result.index("===== changelog start =====")

0 commit comments

Comments
 (0)