|
@ -16,18 +16,15 @@ import click |
|
|
from minio import Minio, InvalidResponseError |
|
|
from minio import Minio, InvalidResponseError |
|
|
from minio.error import S3Error |
|
|
from minio.error import S3Error |
|
|
|
|
|
|
|
|
|
|
|
from acm.logging import setup_basic_logging, update_logging_level |
|
|
|
|
|
|
|
|
# Size of the buffer to read files with |
|
|
# Size of the buffer to read files with |
|
|
BUF_SIZE = 4096 |
|
|
BUF_SIZE = 4096 |
|
|
|
|
|
|
|
|
# Application Version |
|
|
# Application Version |
|
|
VERSION = "1.5.0" |
|
|
|
|
|
|
|
|
|
|
|
LOG = logging.getLogger("acm") |
|
|
|
|
|
LOG.setLevel(logging.ERROR) |
|
|
|
|
|
|
|
|
VERSION = "2.0.0" |
|
|
|
|
|
|
|
|
def setup_logging(is_debug: bool = False): |
|
|
|
|
|
if is_debug: |
|
|
|
|
|
LOG.setLevel(logging.DEBUG) |
|
|
|
|
|
|
|
|
LOG = setup_basic_logging("acm") |
|
|
|
|
|
|
|
|
########### |
|
|
########### |
|
|
# AsyncIO # |
|
|
# AsyncIO # |
|
@ -270,12 +267,19 @@ def load_config(path: str) -> any: |
|
|
@click.pass_context |
|
|
@click.pass_context |
|
|
def cli(ctx, debug, config, stdin, remove_prefix, add_prefix): |
|
|
def cli(ctx, debug, config, stdin, remove_prefix, add_prefix): |
|
|
ctx.ensure_object(dict) |
|
|
ctx.ensure_object(dict) |
|
|
|
|
|
|
|
|
|
|
|
# Propagate the global configs |
|
|
ctx.obj['DEBUG'] = debug |
|
|
ctx.obj['DEBUG'] = debug |
|
|
ctx.obj['CONFIG'] = load_config(config) |
|
|
ctx.obj['CONFIG'] = load_config(config) |
|
|
ctx.obj['READ_STDIN'] = stdin |
|
|
ctx.obj['READ_STDIN'] = stdin |
|
|
ctx.obj['REMOVE_PREFIX'] = remove_prefix |
|
|
ctx.obj['REMOVE_PREFIX'] = remove_prefix |
|
|
ctx.obj['ADD_PREFIX'] = add_prefix |
|
|
ctx.obj['ADD_PREFIX'] = add_prefix |
|
|
setup_logging(debug) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if debug: |
|
|
|
|
|
update_logging_level(3, LOG) |
|
|
|
|
|
|
|
|
|
|
|
# Reduce the logging noise for library loggers |
|
|
|
|
|
update_logging_level(0, "asyncio") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#################### |
|
|
#################### |
|
|