Commit 8c4d5848 authored by Pietro Saccardi's avatar Pietro Saccardi

Giving the option of logging to a file.

parent fd9694da
......@@ -16,8 +16,11 @@ ensure_logging_setup()
def main(args):
if args.token:
SETTINGS.telegram.token = args.token
if args.verbose:
ensure_logging_setup(logging.DEBUG, reset=True)
if args.logfile is not None:
ensure_logging_setup(logging.DEBUG if args.verbose else logging.INFO, reset=True, filename=args.logfile)
ensure_logging_setup(logging.DEBUG if args.verbose else logging.INFO, reset=True)
plugins = get_all_plugins()
assert plugin_telegram.TELEGRAM_ROOT_PLUGIN_NAME in plugins
assert plugin_picamera.PICAMERA_ROOT_PLUGIN_NAME in plugins
......@@ -56,4 +59,6 @@ if __name__ == '__main__':
help='Skip PWM controlled led light.')
parser.add_argument('--verbose', '-v', required=False, default=False, action='store_true',
help='Log up to debug level')
parser.add_argument('--logfile', '--log', dest='logfile', required=False, default=None,
help='Log everything to a file.')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment