cisagov / tpt-reports

Process to build and distribute Technical Phishing Test (TPT) reports
Creative Commons Zero v1.0 Universal
4 stars 0 forks source link

Add additional logging configuration in tpt_reports.py #40

Closed ameliav closed 12 months ago

ameliav commented 1 year ago

💡 Summary

Add configuration so that logs will be appended to an external logging file and have a specified a date format.

Motivation and context

This would be useful for debugging and record keeping because it will provide the logging messages for successes and failures generated by all executions.

Implementation notes

Add additional keyword arguments in logging.basicConfig().

Current logging setup:

logging.basicConfig(
    format="%(asctime)-15s %(levelname)s %(message)s", level=log_level.upper()
)

Example of future logging setup which will also include LOGGING_FILE as a global variable:

logging.basicConfig(
    filename=LOGGING_FILE,
    filemode="a",
    format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
    datefmt="%m/%d/%Y %I:%M:%S",
    level=log_level.upper(),
)

Acceptance criteria