Module RunConfig
source code
Run a Script including logging and error trapping
At the command prompt run this script with the target script as the
first argument. As in this example (but use absolute paths)
>> python.exe RunConfig.py Configfile.py
Initially, this module sets up a console stream log. Then a call to
Run() will execute a script including:
-
set up a log file based on the input script (path_LOG.txt)
-
execute the script [path] within a try-except block
-
print and write log for any exception before quitting
|
AddLogFile(logfile)
Add a logging file handler |
source code
|
|
|
FormatTrace()
trace the current error and format the message |
source code
|
|
|
Run(script)
Run a script with logging and debugging |
source code
|
|
|
log = logging.getLogger()
|
|
formatter = logging.Formatter("%(asctime)s:%(name)s:%(message)...
|
|
ch = logging.StreamHandler()
|
formatter
- Value:
logging.Formatter("%(asctime)s:%(name)s:%(message)s", datefmt= "%H:%M:
%S")
|
|