Package: pcpxlog
PCPXlogPython版-复合日志模块,  通过简单的配置即可以将日志同时输出到控制台、文件、数据库等.Python version of the composite log module, through simple configuration, can output the log to the console, file, database at the same time.第一步: 安装模块Installation目前你可以通过两种方式安装,推荐使用第一种.At present, you can install it in two ways. The first one is recommended.第一种通过pip直接安装, 只需要在终端中输入如下命令即可安装这个模块的最新稳定版本.The first one is installed directly through pip, and the latest stable version of this module can be installed only by typing the following commands in the terminal.pip3installpcpxlog第二种通过git仓库源代码安装.The second is installed through git repository source code.pip3 install git+https://github.com/kerbalwzy/PCPXlog.git@master第二步: 使用模块Quick start在安装好cpxlog包后可通过在终端中输入命令 “ cpxConfigDemo ” 在当前路径下立即得到一个默认的配置文件, 这个文件的名称叫做cpxLogConfig.py, 文件详细内容见链接.After installing the cpxlog package, a default configuration file namedcpxLogConfig.py, can be obtained immediately by typing the command "cpxConfigDemo" in the terminal under the current path. The details of the file can be found in the link.目前我认为cpxlog能被使用到的情况主要有以下两种, 第一种是直接通过CPXLogger获取到logger对象使用, 示例代码如下:At present, I think there are two main situations in which cpxlog can be used. The first one is to get logger objects directly through CPXLogger. The sample code is as follows:frompcpxlogimportCPXLoggerfromcpxLogConfigimportCPXLogConfigDemo# from the cpxLogConfig.py import the config demo class# load config information from classCPXLogger.config_from_class(CPXLogConfigDemo)# ... also support load config from dict and json file.# create loggerlogger=CPXLogger.create_logger()# use logger to record log informationlogger.debug("This is a test for DEBUG level")logger.info("This is a test for INFO level")# ... more log level are supported第二种是在配合其他框架使用时,将CPXLogger创建的所有hander对象,添加到全局的logger对象中去, 这样让其他框架在运行中保存log信息时也能按照我们给CPXLogger配置的规则保存.The second is to add all hander objects created by CPXLogger to the global logger object when used with other frameworks, so that other frameworks can save log information in operation according to the rules we configure CPXLogger.importloggingfrompcpxlogimportCPXLoggerfromcpxLogConfigimportCPXLogConfigDemoCPXLogger.config_from_class(CPXLogConfigDemo)# get global_loggerglobal_logger=logging.getLogger()# add handler from CPXLogger.handlersforhandlerinCPXLogger.handlers:global_logger.addHandler(handler)⚠️ 关于配置文件中的配置信息类该如何去写, 请参考通过命令生成的那个 “cpxLogConfig.py” 文件.⚠️ Refer to the  “cpxLogConfig.py”  file generated by the command for how to write the configuration information class in the configuration file.更多信息和未来发展方向More and Future目前这个cpxlog包能帮助我们通过配置,将日志信息输出到控制台, 文件, MongoDB数据库.未来还希望可以帮助我们将日志信息输出到更多的地方, 例如MySQL, HTTP, Socket 等. 也希望可以通过简单的配置就可以实现在日志信息保存失败时自动发送警告邮件给管理员.如果你想要加入这个项目中, 请Fork这个项目到你的Git用户, 然后加入你的功能代码, 然后发起一个Pull Requests.  同时为了尽量避免出现多个人想要添加同样功能的问题, 请在Issues中声明提前你想为这个项目贡献什么. 同时也可以在Issues中查看你想添加的功能是否已经有人在做或者已经完成了.At present, the cpxlog package can help us output log information to console, file and MongoDB database through configuration.In the future, we hope it can help us output log information to more places, such as MySQL, HTTP, Socket and so on. We also hope it can automatically send warning messages to administrators when log information fails to save through simple configuration.If you want to join this project, please Fork this project to your Git users, then add your code, and then launch a Pull Requests. At the same time, in order to avoid the problem that many people want to add the same function, please declare in Issues what you want to contribute to this project in advance. Also, you can check in Issues to see if the function you want to add already some people is doing or have finished it.目前支持的日志输出方式Supported Present----------------------------------CPXLogger Config Handler Support |----------------------------------Present:                         |
    console                      |
    file                         |
    rotating_file                |
    rotating_mongodb             |
----------------------------------
Future:                          |
    mysql                        |
    redis                        |....                         |----------------------------------