Skip to content
Snippets Groups Projects
Commit 2029264a authored by Sybren A. Stüvel's avatar Sybren A. Stüvel
Browse files

Added `--debug` CLI parameter to enable debug logging

This makes it easier to enable debug logging, as it doesn't require editing
`flamenco-worker.cfg`.
parent 31c3b21e
Branches
Tags
No related merge requests found
......@@ -6,6 +6,8 @@ changed functionality, fixed bugs).
## Version 2.0.8 (in development)
- Fixed parsing of `--config` CLI param on Python 3.5
- Added `--debug` CLI parameter to easily enable debug logging without having
to edit `flamenco-worker.cfg`.
## Version 2.0.7 (released 2017-07-04)
......
......@@ -20,12 +20,16 @@ def main():
help="Erases authentication information and re-registers this worker "
"at the Manager. WARNING: this can cause duplicate worker information "
"in the Manager's database.")
parser.add_argument('-d', '--debug', action='store_true',
help="Enables debug logging for Flamenco Worker's own log entries. "
"Edit the logging config in flamenco-worker.cfg "
"for more powerful options.")
args = parser.parse_args()
# Load configuration
from . import config
confparser = config.load_config(args.config, args.verbose)
config.configure_logging(confparser)
config.configure_logging(confparser, enable_debug=args.debug)
log = logging.getLogger(__name__)
log.debug('Starting')
......
......@@ -116,8 +116,12 @@ def load_config(config_file: pathlib.Path = None,
return confparser
def configure_logging(confparser: configparser.ConfigParser):
def configure_logging(confparser: configparser.ConfigParser, enable_debug: bool):
import logging.config
logging.config.fileConfig(confparser, disable_existing_loggers=True)
logging.captureWarnings(capture=True)
if enable_debug:
logging.getLogger('flamenco_worker').setLevel(logging.DEBUG)
log.debug('Enabling debug logging')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment