Skip to content

Commit

Permalink
util.importer: handle ADVENE_DEBUG in util.importer
Browse files Browse the repository at this point in the history
  • Loading branch information
oaubert committed Mar 1, 2021
1 parent 42810ce commit 61ab3a3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/advene/util/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"""

import logging
import logging.config
logger = logging.getLogger(__name__)

import json
Expand Down Expand Up @@ -662,6 +663,19 @@ def iterator(self):

def main():
logging.basicConfig(level=logging.INFO)
if os.environ.get('ADVENE_DEBUG'):
LOGGING = { 'version': 1,
'disable_existing_loggers': False,
'loggers': { } }
# Handle ADVENE_DEBUG variable.
for m in os.environ.get('ADVENE_DEBUG', '').split(':'):
LOGGING['loggers'][m] = { 'level': 'DEBUG' }
LOGGING['loggers'][m.replace('.', '_')] = { 'level': 'DEBUG' }
# Plugin package name can be mangled
if '.plugins' in m:
LOGGING['loggers'][m.replace('.', '_').replace('_plugins_', '_app_plugins_')] = { 'level': 'DEBUG' }
logging.config.dictConfig(LOGGING)

USAGE = f"{sys.argv[0]} [-o filter_options] filter_name input_file [output_file]"

import advene.core.controller as controller
Expand Down

0 comments on commit 61ab3a3

Please sign in to comment.