Skip to content

Commit 4df95b4

Browse files
author
danwroy
committed
Changed print() statements to new print-only logging method (top-level files only)
Added formatting-free "print_msg" method to nxc_logger, with option to print to log file
1 parent 027e520 commit 4df95b4

5 files changed

Lines changed: 477 additions & 148 deletions

File tree

build_collector.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,28 @@
77
from pathlib import Path
88

99
from shiv.bootstrap import Environment
10-
1110
from shiv.builder import create_archive
1211
from shiv.cli import __version__ as VERSION
1312

13+
from nxc.logger import nxc_logger
14+
1415

1516
def build_nxc():
16-
print("Building nxc")
17+
nxc_logger.print_msg("Building nxc")
1718
try:
1819
shutil.rmtree("bin")
1920
shutil.rmtree("build")
2021
except FileNotFoundError:
2122
pass
2223
except Exception as e:
23-
print(f"Exception while removing bin & build: {e}")
24+
nxc_logger.print_msg(f"Exception while removing bin & build: {e}")
2425

2526
try:
2627
os.mkdir("build")
2728
os.mkdir("bin")
2829
shutil.copytree("nxc", "build/nxc")
2930
except Exception as e:
30-
print(f"Exception while creating bin and build directories: {e}")
31+
nxc_logger.print_msg(f"Exception while creating bin and build directories: {e}")
3132
return
3233

3334
subprocess.run(
@@ -47,7 +48,9 @@ def build_nxc():
4748
[shutil.rmtree(p) for p in Path("build").glob("**/*.dist-info")]
4849

4950
env = Environment(
50-
built_at=datetime.utcfromtimestamp(int(time.time())).strftime("%Y-%m-%d %H:%M:%S"),
51+
built_at=datetime.utcfromtimestamp(int(time.time())).strftime(
52+
"%Y-%m-%d %H:%M:%S"
53+
),
5154
entry_point="nxc.netexec:main",
5255
script=None,
5356
compile_pyc=False,
@@ -65,9 +68,11 @@ def build_nxc():
6568

6669

6770
def build_nxcdb():
68-
print("building nxcdb")
71+
nxc_logger.print_msg("building nxcdb")
6972
env = Environment(
70-
built_at=datetime.utcfromtimestamp(int(time.time())).strftime("%Y-%m-%d %H:%M:%S"),
73+
built_at=datetime.utcfromtimestamp(int(time.time())).strftime(
74+
"%Y-%m-%d %H:%M:%S"
75+
),
7176
entry_point="nxc.nxcdb:main",
7277
script=None,
7378
compile_pyc=False,

0 commit comments

Comments
 (0)