_time.sleep(1) # try the next second
return open(data_path, 'w')
-def _get_logger(log_level=_logging.DEBUG):
+def _get_logger(level=_logging.DEBUG):
logger = _logging.getLogger('slow_bend')
- logger.setLevel(log_level)
+ logger.setLevel(level)
ch = _logging.StreamHandler()
- ch.setLevel(log_level)
+ ch.setLevel(level)
formatter = _logging.Formatter(
'%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
help='Also record the temperature')
parser.add_argument(
'-v', '--verbose', dest='verbose',
- default=False, action='store_const', const=True,
- help='Print lots of debugging information')
+ default=0, action='count',
+ help='Print debugging information (repeat to increase verbosity)')
args = parser.parse_args()
if args.verbose:
- logger = _get_logger()
+ if args.verbose > 1:
+ level = _logging.DEBUG
+ else:
+ level = _logging.INFO
+ logger = _get_logger(level=level)
else:
logger = None