diff --git a/apps/blueman-adapters.in b/apps/blueman-adapters.in index a8e9f4d98..c8fbe2819 100755 --- a/apps/blueman-adapters.in +++ b/apps/blueman-adapters.in @@ -22,20 +22,7 @@ if __name__ == '__main__': parser.add_argument("--socket-id", dest="socket_id", action="store", type=int, metavar="ID") parser.add_argument("adapter", nargs="?", metavar="ADAPTER NAME") args = parser.parse_args() - - if args.LEVEL.upper() == "DEBUG": - log_level = logging.DEBUG - elif args.LEVEL.upper() == "INFO": - log_level = logging.INFO - elif args.LEVEL.upper() == "WARNING": - log_level = logging.WARNING - elif args.LEVEL.upper() == "ERROR": - log_level = logging.ERROR - elif args.LEVEL.upper() == "CRITICAL": - log_level = logging.CRITICAL - else: - log_level = logging.WARNING - + log_level = logging.getLevelName(args.LEVEL.upper()) create_logger(log_level, "blueman-adapters", syslog=args.syslog) set_proc_title() diff --git a/apps/blueman-applet.in b/apps/blueman-applet.in index 1b18d9b4e..3beeedf5a 100755 --- a/apps/blueman-applet.in +++ b/apps/blueman-applet.in @@ -19,20 +19,7 @@ from blueman.main.Applet import BluemanApplet if __name__ == '__main__': parser = create_parser() args = parser.parse_args() - - if args.LEVEL.upper() == "DEBUG": - log_level = logging.DEBUG - elif args.LEVEL.upper() == "INFO": - log_level = logging.INFO - elif args.LEVEL.upper() == "WARNING": - log_level = logging.WARNING - elif args.LEVEL.upper() == "ERROR": - log_level = logging.ERROR - elif args.LEVEL.upper() == "CRITICAL": - log_level = logging.CRITICAL - else: - log_level = logging.WARNING - + log_level = logging.getLevelName(args.LEVEL.upper()) create_logger(log_level, "blueman-applet", syslog=args.syslog) set_proc_title() diff --git a/apps/blueman-manager.in b/apps/blueman-manager.in index b29921caf..eaba9695d 100755 --- a/apps/blueman-manager.in +++ b/apps/blueman-manager.in @@ -19,20 +19,7 @@ from blueman.Functions import set_proc_title, create_parser, create_logger if __name__ == '__main__': parser = create_parser() args = parser.parse_args() - - if args.LEVEL.upper() == "DEBUG": - log_level = logging.DEBUG - elif args.LEVEL.upper() == "INFO": - log_level = logging.INFO - elif args.LEVEL.upper() == "WARNING": - log_level = logging.WARNING - elif args.LEVEL.upper() == "ERROR": - log_level = logging.ERROR - elif args.LEVEL.upper() == "CRITICAL": - log_level = logging.CRITICAL - else: - log_level = logging.WARNING - + log_level = logging.getLevelName(args.LEVEL.upper()) create_logger(log_level, "blueman-manager", syslog=args.syslog) app = Blueman() diff --git a/apps/blueman-mechanism.in b/apps/blueman-mechanism.in index f369090ee..e409f658a 100755 --- a/apps/blueman-mechanism.in +++ b/apps/blueman-mechanism.in @@ -36,19 +36,7 @@ parser.add_argument("-d", "--debug", dest="debug", action="store_true") parser.add_argument("-s", "--stop-timer", dest="stoptimer", action="store_true") args = parser.parse_args() -if args.LEVEL.upper() == "DEBUG": - log_level = logging.DEBUG -elif args.LEVEL.upper() == "INFO": - log_level = logging.INFO -elif args.LEVEL.upper() == "WARNING": - log_level = logging.WARNING -elif args.LEVEL.upper() == "ERROR": - log_level = logging.ERROR -elif args.LEVEL.upper() == "CRITICAL": - log_level = logging.CRITICAL -else: - log_level = logging.WARNING - +log_level = logging.getLevelName(args.LEVEL.upper()) logger = create_logger(log_level, "blueman-mechanism", syslog=True) if args.debug: diff --git a/apps/blueman-sendto.in b/apps/blueman-sendto.in index dfc6e1555..d5dbec6bf 100755 --- a/apps/blueman-sendto.in +++ b/apps/blueman-sendto.in @@ -144,20 +144,7 @@ if __name__ == '__main__': help=_("Files to be send to the bluetooth device")) args = parser.parse_args() - - if args.LEVEL.upper() == "DEBUG": - log_level = logging.DEBUG - elif args.LEVEL.upper() == "INFO": - log_level = logging.INFO - elif args.LEVEL.upper() == "WARNING": - log_level = logging.WARNING - elif args.LEVEL.upper() == "ERROR": - log_level = logging.ERROR - elif args.LEVEL.upper() == "CRITICAL": - log_level = logging.CRITICAL - else: - log_level = logging.WARNING - + log_level = logging.getLevelName(args.LEVEL.upper()) create_logger(log_level, "blueman-sendto", syslog=args.syslog) set_proc_title() diff --git a/apps/blueman-services.in b/apps/blueman-services.in index 8a5fb6e79..c91d26e76 100755 --- a/apps/blueman-services.in +++ b/apps/blueman-services.in @@ -22,20 +22,7 @@ from blueman.main.Services import BluemanServices if __name__ == '__main__': parser = create_parser() args = parser.parse_args() - - if args.LEVEL.upper() == "DEBUG": - log_level = logging.DEBUG - elif args.LEVEL.upper() == "INFO": - log_level = logging.INFO - elif args.LEVEL.upper() == "WARNING": - log_level = logging.WARNING - elif args.LEVEL.upper() == "ERROR": - log_level = logging.ERROR - elif args.LEVEL.upper() == "CRITICAL": - log_level = logging.CRITICAL - else: - log_level = logging.WARNING - + log_level = logging.getLevelName(args.LEVEL.upper()) create_logger(log_level, "blueman-services", syslog=args.syslog) setup_icon_path() diff --git a/apps/blueman-tray.in b/apps/blueman-tray.in index 142b6b496..299d160c5 100755 --- a/apps/blueman-tray.in +++ b/apps/blueman-tray.in @@ -18,20 +18,7 @@ from blueman.main.Tray import BluemanTray if __name__ == '__main__': parser = create_parser() args = parser.parse_args() - - if args.LEVEL.upper() == "DEBUG": - log_level = logging.DEBUG - elif args.LEVEL.upper() == "INFO": - log_level = logging.INFO - elif args.LEVEL.upper() == "WARNING": - log_level = logging.WARNING - elif args.LEVEL.upper() == "ERROR": - log_level = logging.ERROR - elif args.LEVEL.upper() == "CRITICAL": - log_level = logging.CRITICAL - else: - log_level = logging.WARNING - + log_level = logging.getLevelName(args.LEVEL.upper()) create_logger(log_level, "blueman-tray", syslog=args.syslog) set_proc_title() diff --git a/blueman/Functions.py b/blueman/Functions.py index d8810de09..79e690d24 100644 --- a/blueman/Functions.py +++ b/blueman/Functions.py @@ -270,7 +270,7 @@ def create_parser( parser = argparse.ArgumentParser() if loglevel: - parser.add_argument("--loglevel", dest="LEVEL", default="warning") + parser.add_argument("--loglevel", dest="LEVEL", default="WARNING") if syslog: parser.add_argument("--syslog", dest="syslog", action="store_true")