Skip to content

Commit

Permalink
Merge pull request #11 from eletrixtime/patch-1
Browse files Browse the repository at this point in the history
Added JSON to the end of the crash report file
  • Loading branch information
FewerElk authored Aug 28, 2024
2 parents f7d72a0 + 45157f5 commit 4d28a05
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion libs/crash_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@
import random
from datetime import datetime
from main import SERVER_VERSION
import json

TOTAL_PLUGIN = 0
def gen_crash_report():
global TOTAL_PLUGIN
with open(f"logs/crash_{datetime.timestamp( datetime.now() )}.txt", "w") as f:

plugin_list = ""
for p in os.listdir("plugins"):
plugin_list += f"- {p}\n"
TOTAL_PLUGIN += 1
json_info = json.dumps({"beaconmc_version": SERVER_VERSION,"os_name": os.name,"date": datetime.now().isoformat(),"python_version": sys.version,"total_plugin": TOTAL_PLUGIN,"traceback_error": traceback.format_exc()})
f.write(f"""
=========================================
BEACON-MC CRASH REPORT
Expand All @@ -31,7 +37,11 @@ def gen_crash_report():
Plugins List :
{plugin_list}
Date : {datetime.now()}
NOTE : Please **dont touch the error file if you want to use our debug tools !!!**
=========================================
JSON Info :
{json_info}
""")
f.close()
print("\n")
Expand All @@ -41,4 +51,7 @@ def gen_crash_report():
print("> Please submit the report on the issue tracker.")
print("> Thank ^^")
print("==========================================")
exit(1)
print(f"Crash report saved on logs/{datetime.timestamp(datetime.now())}")

print(f"ERR : {traceback.format_exc()}")
exit(1)

0 comments on commit 4d28a05

Please sign in to comment.