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

User defined logger for activity and campaign is redundant #173

Open
wigging opened this issue Jun 7, 2024 · 0 comments
Open

User defined logger for activity and campaign is redundant #173

wigging opened this issue Jun 7, 2024 · 0 comments

Comments

@wigging
Copy link
Collaborator

wigging commented Jun 7, 2024

To create a script for a zambeze activity and campaign, the user must create a logger such as:

# Setup and configure logger
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)

fmt = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
ch.setFormatter(fmt)

logger.addHandler(ch)

This logger is then passed to the ShellActivity and Campaign objects. The logger should be created within the campaign class or elsewhere in zambeze. Instead of passing a logger object to the campaign class, an argument can be used to enable/disable logging for the campaign such as Campaign(enable_logging=True). Regarding the activity class, there is no reason to pass a logger to the activity so just remove the Activity(logger) argument.

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