EOX GitLab Instance

Skip to content
Snippets Groups Projects
Commit 2347c1c5 authored by Fabian Schindler's avatar Fabian Schindler
Browse files

Logging setup

parent 515d9b79
No related branches found
No related tags found
No related merge requests found
import click
import yaml
import logging
import logging.config
from .preprocess import preprocess_file
def setup_logging(debug=False):
logging.config.dictConfig({
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'brief': {
'format': '%(levelname)s %(name)s: %(message)s'
}
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'level': 'DEBUG' if debug else 'INFO',
'formatter': 'brief',
}
},
'root': {
'handlers': ['console'],
'level': 'DEBUG' if debug else 'INFO',
}
})
@click.group()
# @click.argument('--config', envvar='PREPROCESS_CONFIG', type=click.File('r'))
def cli():
pass
setup_logging(True)
@cli.command(help='Run the preprocess daemon, attaching to a Redis queue')
......@@ -26,5 +48,4 @@ def preprocess(file_path, config_file=None, use_dir=None):
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
cli()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment