Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow script_end() to take an argument #35

Open
jonathannoah opened this issue Nov 22, 2022 · 0 comments
Open

Allow script_end() to take an argument #35

jonathannoah opened this issue Nov 22, 2022 · 0 comments

Comments

@jonathannoah
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant