From c911adb9a049c3a4de47c35dc3af2771661784e5 Mon Sep 17 00:00:00 2001
From: Shrikanth Upadhayaya <shrik450@gmail.com>
Date: Wed, 16 Oct 2024 11:28:44 -0400
Subject: [PATCH] Support passing log level from the action

---
 action.yml    |  8 ++++++++
 entrypoint.py | 13 +++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/action.yml b/action.yml
index df5c062..8932a59 100644
--- a/action.yml
+++ b/action.yml
@@ -33,6 +33,12 @@ inputs:
       BOM will be generated for the default variant. Not supported for OrCAD
       projects.
     default: ""
+  log_level:
+    description: >
+      The level at which to log. Use "DEBUG" to get more information, such as
+      about which file was used to match which device sheet.
+    required: false
+    default: INFO
   auth_token:
     description: >
       The AllSpice Hub Auth token to use. If not provided, the autogenerated
@@ -55,6 +61,8 @@ runs:
     - ${{ inputs.variant }}
     - "--output_file"
     - "${{ github.workspace}}/${{ inputs.output_file_name }}"
+    - "--log-level"
+    - ${{ inputs.log_level }}
     - ${{ github.repository }}
     - ${{ inputs.source_path }}
   env:
diff --git a/entrypoint.py b/entrypoint.py
index 1c73f91..58ffb16 100755
--- a/entrypoint.py
+++ b/entrypoint.py
@@ -68,6 +68,11 @@ if __name__ == "__main__":
             "generated for the default variant. This is not used for OrCAD projects."
         ),
     )
+    parser.add_argument(
+        "--log-level",
+        help="The log level for the logger. Defaults to INFO.",
+        default="INFO",
+    )
 
     args = parser.parse_args()
 
@@ -113,9 +118,13 @@ if __name__ == "__main__":
         exit(1)
 
     if args.allspice_hub_url is None:
-        allspice = AllSpice(token_text=auth_token)
+        allspice = AllSpice(token_text=auth_token, log_level=args.log_level)
     else:
-        allspice = AllSpice(token_text=auth_token, allspice_hub_url=args.allspice_hub_url)
+        allspice = AllSpice(
+            token_text=auth_token,
+            allspice_hub_url=args.allspice_hub_url,
+            log_level=args.log_level,
+        )
 
     repo_owner, repo_name = args.repository.split("/")
     repository = allspice.get_repository(repo_owner, repo_name)