All Projects → kerbalwzy → PCPXlog

kerbalwzy / PCPXlog

Licence: MPL-2.0 license
通过简单配置将日志同时输出到console、file、MongoDB | 可以pip安装

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to PCPXlog

logy
Parse log files like a pro with this awesome CLI tool. Paginate and filter with great ease.
Stars: ✭ 28 (+115.38%)
Mutual labels:  log
LogDelegate
Simple, pretty and powerful logger for android
Stars: ✭ 287 (+2107.69%)
Mutual labels:  log
LogiAM
基于日志模板构建,采集任务动态管控、数据质量精确度量,一站式日志采集平台
Stars: ✭ 199 (+1430.77%)
Mutual labels:  log
datalogger
DataLogger foi projetado para ser uma biblioteca simples de log com suporte a vários providers.
Stars: ✭ 46 (+253.85%)
Mutual labels:  log
woodpecker-client
异常日志收集客户端 环境隔离版本
Stars: ✭ 51 (+292.31%)
Mutual labels:  log
LogDNA-Android-Client
Android client for LogDNA
Stars: ✭ 22 (+69.23%)
Mutual labels:  log
Matomo
Liberating Web Analytics. Star us on Github? +1. Matomo is the leading open alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. We love Pull Requests!
Stars: ✭ 15,711 (+120753.85%)
Mutual labels:  log
TLog
Android日志工具
Stars: ✭ 16 (+23.08%)
Mutual labels:  log
aiologger
Asynchronous logging for Python and asyncio
Stars: ✭ 92 (+607.69%)
Mutual labels:  log
Log
Daily logging tool and data visualizer.
Stars: ✭ 30 (+130.77%)
Mutual labels:  log
log
Aplus Framework Log Library
Stars: ✭ 14 (+7.69%)
Mutual labels:  log
ng-logger
Angular logger service
Stars: ✭ 65 (+400%)
Mutual labels:  log
JJSwiftLog
Swift log library for all platform
Stars: ✭ 51 (+292.31%)
Mutual labels:  log
git-tui
Collection of human friendly terminal interface for git.
Stars: ✭ 95 (+630.77%)
Mutual labels:  log
rust cms
使用Rust编写一个CMS(内容管理系统)可以做为个人博客,公司网站
Stars: ✭ 32 (+146.15%)
Mutual labels:  log
Mars
Mars is a cross-platform network component developed by WeChat.
Stars: ✭ 15,912 (+122300%)
Mutual labels:  log
pyqso
PyQSO is a contact logging tool for amateur radio operators.
Stars: ✭ 75 (+476.92%)
Mutual labels:  log
base
小而美的业务基础框架,也是本项目的核心
Stars: ✭ 47 (+261.54%)
Mutual labels:  log
crab
Golang API Framework
Stars: ✭ 57 (+338.46%)
Mutual labels:  log
LogESP
Open Source SIEM (Security Information and Event Management system).
Stars: ✭ 162 (+1146.15%)
Mutual labels:  log

PCPXlog

Python版-复合日志模块, 通过简单的配置即可以将日志同时输出到控制台、文件、数据库等.

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.

pip3 install pcpxlog 

第二种通过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 named cpxLogConfig.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:

from pcpxlog import CPXLogger

from cpxLogConfig import CPXLogConfigDemo  
# from the cpxLogConfig.py import the config demo class

# load config information from class
CPXLogger.config_from_class(CPXLogConfigDemo)
# ... also support load config from dict and json file.

# create logger
logger = CPXLogger.create_logger()

# use logger to record log information
logger.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.

import logging
from pcpxlog import CPXLogger
from cpxLogConfig import CPXLogConfigDemo  

CPXLogger.config_from_class(CPXLogConfigDemo)

# get global_logger
global_logger = logging.getLogger()
# add handler from CPXLogger.handlers
for handler in CPXLogger.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                        |
    ....                         |
----------------------------------
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].