def initialize_system_logging(opts): # set up the logger for external programs if opts.check_commands: logformat = "%(message)s" else: logformat = "%(levelname)s %(asctime)s %(message)s" if opts.logfileName is not None: system.rename_logfile(opts.logfileName) system.setup_logger(logfilename=opts.logfileName, logformat=logformat) else: system.setup_logger(logformat=logformat) if (opts.check_commands): system.set_check_commands(True)
parser.add_option("--log-file", help="Specify the filename for logging stdout and stderr outputs", dest="logfileName", default=None) parser.add_option("--log-commands", help="Specify if the script logs only command lines not executing those", action="store_true", dest="log_commands") parser.add_option("--verbose", help="Print out logs to cosnole", action="store_true", dest="verbose", default=False) (opts, args) = parser.parse_args() # set up the logger for external programs if opts.log_commands: logformat = "%(message)s" else: logformat = "%(levelname)s %(asctime)s %(message)s" if opts.logfileName is not None: system.rename_logfile(opts.logfileName) system.setup_logger(logfilename=opts.logfileName, logformat=logformat) else: system.setup_logger(logformat=logformat) # argument processing if (len(args) < 2): parser.print_help() else: csvfile = args[0] outputdir = args[1] #bmsfile = args[1] if (not os.path.isdir("%s/Processing/1.MeasurementandSPHARM" % (outputdir))): os.makedirs("%s/Processing/1.MeasurementandSPHARM" % (outputdir))
parser.add_option("--verbose", help="Print out logs to cosnole", action="store_true", dest="verbose", default=False) (opts, args) = parser.parse_args() # set up the logger for external programs if opts.log_commands: logformat = "%(message)s" else: logformat = "%(levelname)s %(asctime)s %(message)s" if opts.logfileName is not None: system.rename_logfile(opts.logfileName) system.setup_logger(logfilename=opts.logfileName, logformat=logformat) else: system.setup_logger(logformat=logformat) # argument processing if (len(args) < 2): parser.print_help() else: csvfile = args[0] outputdir = args[1] #bmsfile = args[1] if (not os.path.isdir("%s/Processing/1.MeasurementandSPHARM" % (outputdir))): os.makedirs("%s/Processing/1.MeasurementandSPHARM" % (outputdir))