6
mirror of https://github.com/AllSpiceIO/cofactr-cogs.git synced 2025-04-18 07:48:55 +00:00

Add debug printing

This commit is contained in:
Jonathan Tran 2024-05-23 17:22:43 -04:00
parent f82285d690
commit 5730c56703
No known key found for this signature in database
2 changed files with 17 additions and 0 deletions

View File

@ -41,6 +41,9 @@ inputs:
client_id:
description: "Cofactr Client ID"
required: true
log_level:
description: Set log level for debugging
default: info
runs:
using: "docker"
image: "Dockerfile"
@ -57,6 +60,8 @@ runs:
- ${{ inputs.search_strategy }}
- "--output-file"
- ${{ inputs.output_file }}
- "--log-level"
- ${{ inputs.log_level }}
- ${{ inputs.bom_file }}
env:
ALLSPICE_AUTH_TOKEN: ${{ github.token }}

View File

@ -153,6 +153,11 @@ def main() -> None:
"--output-file",
help="The path to the output file. Defaults to stdout, i.e. printing to the console.",
)
parser.add_argument(
"--log-level",
help="The log level to use. Defaults to '%(default)s'.",
default="info",
)
args = parser.parse_args()
@ -184,6 +189,13 @@ def main() -> None:
"Search strategy requires manufacturer, but no BOM manufacturer column was provided. Please set bom_manufacturer_column."
)
if args.log_level.lower() == "debug":
print(f"Using part number column: {part_number_column!r}", file=sys.stderr)
print(f"Using manufacturer column: {manufacturer_column!r}", file=sys.stderr)
print(f"Using use_mfr: {use_mfr!r}", file=sys.stderr)
print(f"Using quantity column: {quantity_column!r}", file=sys.stderr)
print(f"Using search strategy: {search_strategy!r}", file=sys.stderr)
for part in parts:
part_number = part[part_number_column]
manufacturer = part[manufacturer_column] if use_mfr else ""