Skip to content

Commit

Permalink
Add flag to force enable logging of debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeJoeTV committed Aug 29, 2023
1 parent a53c35e commit 811e889
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions AstroTuxLauncher.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def ensure_toml_config(config_path):

class AstroTuxLauncher():

def __init__(self, config_path, astro_path, depotdl_exec):
def __init__(self, config_path, astro_path, depotdl_exec, force_debug_log=False):
# Setup basic logging
interface.LauncherLogging.prepare()
interface.LauncherLogging.setup_console()
Expand All @@ -185,6 +185,10 @@ def __init__(self, config_path, astro_path, depotdl_exec):
if not (astro_path is None):
self.config = dataclasses.replace(self.config, {"AstroServerPath": astro_path})

# If flag was passed, overrule config option
if force_debug_log:
self.config.LogDebugMessages = True

# Make sure we use absolute paths
self.config.AstroServerPath = path.abspath(self.config.AstroServerPath)
self.config.WinePrefixPath = path.abspath(self.config.WinePrefixPath)
Expand Down Expand Up @@ -507,6 +511,7 @@ def exit(self, graceful=False, reason=None):
parser.add_argument("-c", "--config_path", help="The location of the configuration file (default: %(default)s)", type=str, dest="config_path", default="launcher.toml")
parser.add_argument("-p", "--astro_path", help="The path of the Astroneer Dedicated Server installation (default: %(default)s)", dest="astro_path", default=None)
parser.add_argument("-d", "--depotdl_exec", help="The path to anm existing depotdownloader executable (default: %(default)s)", dest="depotdl_exec", default=None)
parser.add_argument("-l", "--log_debug", help="Also log debug messages (Overrules config option)", action='store_true', dest="log_debug", default=False)

args = parser.parse_args()

Expand All @@ -522,7 +527,7 @@ def exit(self, graceful=False, reason=None):
print("")

try:
launcher = AstroTuxLauncher(args.config_path, args.astro_path, args.depotdl_exec)
launcher = AstroTuxLauncher(args.config_path, args.astro_path, args.depotdl_exec, force_debug_log=args.log_debug)
except KeyboardInterrupt:
print("Quitting... (requested by user)")
sys.exit(0)
Expand Down

0 comments on commit 811e889

Please sign in to comment.