1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

feat(mcs): add -v option to enable logging to console

refactor(ci): switch S3 uploading to AWS CLI for logging S3 link

docs: update README with to reflect changes in Drone pipeline

feat(env): add activate script for portable Python

fix(logging): log RequestException response body
This commit is contained in:
Alexander Presnyakov
2025-03-12 17:26:20 +00:00
parent a329f4d428
commit de7a4a2d7e
13 changed files with 133 additions and 23 deletions

View File

@ -4,7 +4,7 @@ import sys
import typer
from cmapi_server.logging_management import dict_config, add_logging_level
from cmapi_server.logging_management import dict_config, add_logging_level, enable_console_logging
from mcs_cluster_tool import (
cluster_app, cmapi_app, backup_commands, restore_commands
)
@ -38,10 +38,20 @@ def help_all():
# Open the man page in interactive mode
subprocess.run(['man', 'mcs'])
@app.callback()
def main(verbose: bool = typer.Option(False, '--verbose', '-v', help='Enable verbose logging to console')):
'''Add a -v option and setup logging in every subcommand'''
setup_logging(verbose)
def setup_logging(verbose: bool = False) -> None:
add_logging_level('TRACE', 5)
dict_config(MCS_CLI_LOG_CONF_PATH)
if verbose:
enable_console_logging(logging.getLogger())
if __name__ == '__main__':
add_logging_level('TRACE', 5) #TODO: remove when stadalone mode added.
dict_config(MCS_CLI_LOG_CONF_PATH)
logger = logging.getLogger('mcs_cli')
# add separator between cli commands logging
logger.debug(f'{"-":-^80}')

View File

@ -21,13 +21,13 @@ def handle_output(func):
return_code = 0
except CMAPIBasicError as err:
typer.echo(err.message, err=True)
logger.error('Error while command execution', exc_info=True)
logger.error('Error during command execution', exc_info=True)
except typer.BadParameter as err:
logger.error('Bad command line parameter.')
raise err
except Exception:
logger.error(
'Undefined error while command execution',
'Undefined error during command execution',
exc_info=True
)
typer.echo('Unknown error, check the log file.', err=True)