Skip to content

Allow script_end() to take an argument #35

Description

@jonathannoah

The script_end() method currently emits a hard-coded "Exit 0" line to the log:

def script_end(self):
"""Log end of script"""
self.log.info(self.asterisk)
self.log.info("Exit 0")

Adding a parameter to this function will allow the user to pass an exit code for the function to log in place of the default:

def script_end(self, exit_code=0):
    """Log end of script"""
    self.log.info(self.asterisk)
    self.log.info(f"Exit {exit_code}")

This is helpful if the user is calling sys.exit() to pass non-0 exit codes and wishes to record an accurate exit code in the log.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions