Skip to content
Snippets Groups Projects
Commit 2a55fa56 authored by Dennis Ahrens's avatar Dennis Ahrens
Browse files

[TASK] Allow setting the logformat by argument.

-l or --logformat allows you to define your log
format. See [1] for details.

[1] https://docs.python.org/2/library/logging.html#logrecord-attributes
parent e191182c
No related branches found
No related tags found
No related merge requests found
...@@ -102,6 +102,7 @@ def _argparse(config_file = None, working_directory = None): ...@@ -102,6 +102,7 @@ def _argparse(config_file = None, working_directory = None):
parser.add_argument('--init', action = 'store_true', help = 'Make your current directory a new working directory with sample content.') parser.add_argument('--init', action = 'store_true', help = 'Make your current directory a new working directory with sample content.')
parser.add_argument('-e', '--explain', action = 'store_true', help = 'Just shows you all jobs in execution order, with name and description') parser.add_argument('-e', '--explain', action = 'store_true', help = 'Just shows you all jobs in execution order, with name and description')
parser.add_argument('-i', '--interactive', action = 'store_true', help = 'Ask before each job execution.') parser.add_argument('-i', '--interactive', action = 'store_true', help = 'Ask before each job execution.')
parser.add_argument('-l', '--logformat', dest = 'logformat', help = 'The format of the logging output.', default = '%(levelname)s: %(message)s')
parser.add_argument('-p', '--profile', action = 'store_true') parser.add_argument('-p', '--profile', action = 'store_true')
return parser return parser
...@@ -136,7 +137,7 @@ class Controller(object): ...@@ -136,7 +137,7 @@ class Controller(object):
self.interactive = args.interactive self.interactive = args.interactive
self.profile = args.profile self.profile = args.profile
logging.basicConfig(stream = sys.stdout, level = logging.DEBUG if args.verbose else logging.INFO, format = '%(levelname)s: %(message)s') logging.basicConfig(stream = sys.stdout, level = logging.DEBUG if args.verbose else logging.INFO, format = args.logformat)
logging.debug('I am chatty now! Lets shovel data :)') logging.debug('I am chatty now! Lets shovel data :)')
if args.init: if args.init:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment