diff --git a/jina/logging/base.py b/jina/logging/base.py index 0d17493c79cd7..7cd6d2ea123e4 100644 --- a/jina/logging/base.py +++ b/jina/logging/base.py @@ -224,7 +224,7 @@ def get_logger(context: str, context_len: int = 15, console_handler.setFormatter(ColorFormatter(fmt_str)) logger.addHandler(console_handler) - success_level = 25 # between WARNING and INFO + success_level = LogVerbosity.SUCCESS.value # between WARNING and INFO logging.addLevelName(success_level, 'SUCCESS') setattr(logger, 'success', lambda message: logger.log(success_level, message)) diff --git a/tests/test_logging.py b/tests/test_logging.py new file mode 100644 index 0000000000000..9cedca4edb72d --- /dev/null +++ b/tests/test_logging.py @@ -0,0 +1,17 @@ +import os + +from jina.logging.base import get_logger +from tests import JinaTestCase + + +class MyTestCase(JinaTestCase): + + def test_logging_message(self): + os.environ['JINA_LOG_VERBOSITY'] = 'success' + logger = get_logger('test_logger') + logger.debug('this is test debug message') + logger.info('this is test info message') + logger.success('this is test success message') + logger.warning('this is test warning message') + logger.error('this is test error message') + logger.critical('this is test critical message')