Skip to content

Commit 9f7c35c

Browse files
authored
Merge pull request Pennyw0rth#722 from Pennyw0rth/neff-fix-version-log
Move version log after file logger is attached
2 parents fbc787c + 8e30699 commit 9f7c35c

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

nxc/cli.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def gen_cli_args():
2525
COMMIT = ""
2626
DISTANCE = ""
2727
CODENAME = "SmoothOperator"
28-
nxc_logger.debug(f"NXC VERSION: {VERSION} - {CODENAME} - {COMMIT} - {DISTANCE}")
2928

3029
generic_parser = argparse.ArgumentParser(add_help=False, formatter_class=DisplayDefaultsNotNone)
3130
generic_group = generic_parser.add_argument_group("Generic", "Generic options for nxc across protocols")
@@ -133,7 +132,7 @@ def gen_cli_args():
133132
if hasattr(args, "get_output_tries"):
134133
args.get_output_tries = args.get_output_tries * 10
135134

136-
return args
135+
return args, [CODENAME, VERSION, COMMIT, DISTANCE]
137136

138137

139138
def get_module_names():

nxc/netexec.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ async def start_run(protocol_obj, args, db, targets): # noqa: RUF029
6969

7070
def main():
7171
first_run_setup(nxc_logger)
72-
args = gen_cli_args()
72+
args, version_info = gen_cli_args()
7373

7474
# if these are the same, it might double log to file (two FileHandlers will be added)
7575
# but this should never happen by accident
@@ -78,6 +78,8 @@ def main():
7878
if hasattr(args, "log") and args.log:
7979
nxc_logger.add_file_log(args.log)
8080

81+
CODENAME, VERSION, COMMIT, DISTANCE = version_info
82+
nxc_logger.debug(f"NXC VERSION: {VERSION} - {CODENAME} - {COMMIT} - {DISTANCE}")
8183
nxc_logger.debug(f"PYTHON VERSION: {sys.version}")
8284
nxc_logger.debug(f"RUNNING ON: {platform.system()} Release: {platform.release()}")
8385
nxc_logger.debug(f"Passed args: {args}")

0 commit comments

Comments
 (0)