Include filename on exit.
authorScott Gasch <[email protected]>
Fri, 9 Jun 2023 21:30:38 +0000 (14:30 -0700)
committerScott Gasch <[email protected]>
Fri, 9 Jun 2023 21:30:38 +0000 (14:30 -0700)
src/pyutils/bootstrap.py

index 7ef7ef13963a2a8cdb92c86c2657dca4826d9e92..6d4e63b75a92df30d37e69659388dd6f6eb30881 100644 (file)
@@ -307,6 +307,8 @@ def initialize(entry_point):
             ):
                 entry_filename = entry_point.__globals__["__file__"]
                 entry_descr = entry_filename
+        if not entry_filename:
+            entry_filename = 'UNKNOWN'
         config.parse(entry_filename)
 
         if config.config["trace_memory"]:
@@ -426,10 +428,11 @@ def initialize(entry_point):
         )
 
         # If it doesn't return cleanly, call attention to the return value.
+        base_filename = os.path.basename(entry_filename)
         if ret is not None and ret != 0:
-            logger.error("Exit %s", ret)
+            logger.error("%s: Exit %s", base_filename, ret)
         else:
-            logger.debug("Exit %s", ret)
+            logger.debug("%s: Exit %s", base_filename, ret)
         sys.exit(ret)
 
     return initialize_wrapper