Skip to content

Commit 1867652

Browse files
committed
dont output log during info output
1 parent e9a2f0d commit 1867652

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

tc2_launcher/__main__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,14 @@ def main():
142142
# Handle hidden info flags early
143143
temp_args, _ = parser.parse_known_args()
144144
if temp_args.vulkan_info:
145+
logger.setup_silent_logger()
145146
from tc2_launcher.hardware import _get_vulkan_info_internal
146147
import json
147148
is_supported, gpu_info, error_msg = _get_vulkan_info_internal()
148149
print(json.dumps({"is_supported": is_supported, "gpu_info": gpu_info, "error_msg": error_msg}))
149150
return
150151
if temp_args.dx_info:
152+
logger.setup_silent_logger()
151153
from tc2_launcher.hardware import get_dx_info
152154
import json
153155
is_supported, gpu_info, error_msg = get_dx_info()

tc2_launcher/logger.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ def setup_logger(log_folder: Path):
5454
root_log.setLevel(log_level)
5555

5656

57+
def setup_silent_logger():
58+
global root_log
59+
root_log = logging.getLogger("tc2_launcher")
60+
root_log.addHandler(logging.NullHandler())
61+
root_log.setLevel(logging.CRITICAL + 1)
62+
root_log.propagate = False
63+
64+
5765
def critical(msg):
5866
if root_log is None:
5967
logging.critical(msg)

0 commit comments

Comments
 (0)