Tools: Fix script logging
Fix issue preventing scripts respecting --log_level argument, by adding
a non-default handler. Also, add script name to log output.
Change-Id: I100a5c29276d362dc38cd6c46f472e5991873293
Signed-off-by: Raef Coles <raef.coles@arm.com>
diff --git a/tools/modules/c_include.py b/tools/modules/c_include.py
index 636f31d..e3185dc 100644
--- a/tools/modules/c_include.py
+++ b/tools/modules/c_include.py
@@ -9,6 +9,9 @@
import os
import json
+import logging
+logger = logging.getLogger("TF-M.{}".format(__name__))
+
def get_compile_command(compile_commands_file, c_file):
with open(compile_commands_file, "rt") as f:
compile_commands = json.load(f)
@@ -32,7 +35,8 @@
parser.add_argument("--c_file", help="name of the c file to take", required=True)
parser.add_argument("--log_level", help="log level", required=False, default="ERROR", choices=logging._levelToName.values())
args = parser.parse_args()
- logger.setLevel(args.log_level)
+ logging.getLogger("TF-M").setLevel(args.log_level)
+ logger.addHandler(logging.StreamHandler())
print(get_compile_command(args.compile_commands_file, args.c_file))
print(get_includes(args.compile_commands_file, args.c_file))