Skip to content

Commit

Permalink
improve logging setup timing
Browse files Browse the repository at this point in the history
start logging right after parsing CLI input

update logging level after parsing CLI args
  • Loading branch information
n8marti committed Jan 2, 2024
1 parent 4899411 commit a113043
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions LogosLinuxInstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ def restore():
def main():
cli_args = parse_command_line()

# Initialize logging.
initialize_logging(logging.WARNING)

die_if_running()
die_if_root()

Expand All @@ -132,16 +135,16 @@ def main():
config_file = config.LEGACY_CONFIG_FILE
config.set_config_env(config_file)

# Parse CLI args and update affected config vars.
parse_args(cli_args)

# Update logging level from config.
logger = logging.getLogger()
logger.setLevel(config.LOG_LEVEL)

parse_args(cli_args)

if config.DELETE_INSTALL_LOG and os.path.isfile(config.LOGOS_LOG):
os.remove(config.LOGOS_LOG)
initialize_logging(config.LOG_LEVEL)


# If Logos app is installed, run the desired Logos action.
if config.LOGOS_EXE is not None and os.access(config.LOGOS_EXE, os.X_OK):
if config.ACTION == 'control':
Expand Down

0 comments on commit a113043

Please sign in to comment.