# chance-mock-logger **Repository Path**: QianFuFinancial/chance-mock-logger ## Basic Information - **Project Name**: chance-mock-logger - **Description**: 用于捕获logging输出作为测试校验的对象 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2017-11-01 - **Last Updated**: 2020-12-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Chance-mock-logger ![CI status](https://img.shields.io/badge/build-passing-brightgreen.svg) ChanceMockLogger is a Python library for capturing the output of logging to be evaluated in tests. ## Installation ### Requirements * Linux * Python 2.7 and up `$ pip install chance-mock-logger` ## Usage ```python from mock_logger import MockLoggingHandler # Initialize handler HANDLER = MockLoggingHandler() # Setup logger logger = logging.getLogger(THE_NAME_OF_YOUR_LOGGER) logger.addHandler(HANDLER) # Start Capture HANDLER.reset() #...Something is done with logger # Checkout the output HANDLER.messages("error") HANDLER.messages("info") HANDLER.messages("warning") HANDLER.messages("debug") ``` ## Development ``` $ virtualenv mock_logger $ . mock_logger/bin/activate $ pip install -e . ``` ## Contributing Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate. ## License [MIT](https://choosealicense.com/licenses/mit/)