Added --debug switch to enable debug logging level

Fri, 26 Jan 2018 10:35:00 +0000

author
Tuomo Valkonen <tuomov@iki.fi>
date
Fri, 26 Jan 2018 10:35:00 +0000
changeset 73
4f0e9cf8f230
parent 72
e0e6043779e2
child 74
4f56142e7497

Added --debug switch to enable debug logging level

borgend.py file | annotate | diff | comparison | revisions
--- a/borgend.py	Fri Jan 26 10:31:21 2018 +0000
+++ b/borgend.py	Fri Jan 26 10:35:00 2018 +0000
@@ -17,7 +17,7 @@
 # Logging configuration
 #
 
-loglevel=logging.DEBUG
+loglevel=logging.INFO
 logfmt="%(asctime)s:%(levelname)s:%(name)s:%(message)s"
 fifolog_capacity=1000
 fifolog_fmt="%(asctime)s:%(levelname)s:%(message)s"
@@ -59,6 +59,12 @@
         action='store_true',
         help='Do not show the tray icon')
 
+    parser.add_argument(
+        '--debug',
+        dest='debug',
+        action='store_true',
+        help='Set logging level to debug')
+
     return parser.parse_args()
 
 #
@@ -79,6 +85,9 @@
     try:
         args=do_args()
 
+        if args.debug:
+            logger.setLevel(logging.DEBUG)
+
         if not os.path.isdir(config.logs_dir):
             os.makedirs(config.logs_dir)
 

mercurial