Open btleyden opened 3 years ago
I've currently copied my regular logging system into gslab_builder
as a test-run on my iMac's copy of ios_ratings_innovation
. After this project reaches its next milestone I'll return to this and decide whether to make further adjustments or commit the changes.
This approach logs at the info level, but displayed "BUILDER" to distinguish it from any info logging within specific scripts.
The header code is:
import logging
# Setup Logging
stdout_handler = logging.StreamHandler(sys.stdout)
stdout_handler.setFormatter(
logging.Formatter(
"%(asctime)s (BUILDER) --- %(message)s", "%Y-%m-%d %H:%M:%S"
)
)
logging.getLogger().addHandler(stdout_handler)
logging.getLogger().setLevel(logging.INFO)
And the following is added to the execute_system_call
method:
logging.info('Running: {}'.format(self.system_call))
Need to keep an eye on the conclusion of the logging issue in https://github.com/btleyden/sherlock/issues/5.
Basically, running the logging setup in the header of the script may result in duplicate logging statements. Instead, logging should be set up on an individual level under if __name__ == "__main__"
. And so the logging.info
line should remain here, but the rest should be removed.
So that's the plan for this, unless the above-mentioned issue resolves in an unexpected way, is the make that change and then close this for now.
While individual scripts may log progress when running
run.py
, there's currently nothing in place (as best I can tell) that provides overall guidance regarding progress, particularly on the command line.I previously added a print statement to
gslab_builder.py
, but that's either being held up until work is complete or swallowed up by some other part of the system.The goal of this task is to add logging to
gslab_builder
(or elsewhere if appropriate) to provide updates on which scripts are running and when.