一个安全可靠高效的进程间日志处理器 A safe, reliable and efficient inter process log processor 新增压缩和压缩等级参数 add gzip fix bugs
Project description
多进程日志切换处理器
-
一个安全可靠高效的进程间日志处理器 A safe, reliable and efficient inter process log processor fix bugs 修复上一版的bug
-
speed about 7100 lines/s 0.8M/s (10 processes) 7100行/s 0.8M/s 测试环境 虚拟机(virtual machine)
-
CentOS7 64
-
python3.7
-
机械硬盘 hard disk
-
添加测试用例
-
新增参数 need_zip 是否需要日志压缩 布尔值 (需要以命名关键字参数传入)
-
新增参数 compresslevel 日志压缩的gzip等级 默认为9 (需要以命名关键字参数传入)
-
v 0.5 修复上一版(0.4)的bug
-
import logging from multiprocessing import Process from logging import Formatter from multiprocess_logger import MultiprocessingHandler handler = MultiprocessingHandler(filename='./ppp.log', maxBytes=1024 * 1024, backupCount=10, need_zip=True, compresslevel=9) fmt = Formatter(fmt='%(asctime)s - %(process)d - %(name)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s') handler.setFormatter(fmt=fmt) logger = logging.getLogger('SHIT') logger.addHandler(handler) logger.setLevel(logging.INFO) logging.basicConfig(level=logging.ERROR, format='%(asctime)s - %(process)d - %(name)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s') def write_log(): while True: logger.info('Hello World!------------Hello World!') if __name__ == '__main__': # write_log() p_list = [] for i in range(6): p_list.append(Process(target=write_log)) for i in p_list: i.start()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file multiprocess_logger-0.5.tar.gz
.
File metadata
- Download URL: multiprocess_logger-0.5.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae0e23d8b6fc0f86ef1d3e73562ca594fb02ea74ade7e6a86fee25fde225dcbf |
|
MD5 | d417d149c2f8c5c00ccb040ddf928b8a |
|
BLAKE2b-256 | 503a152de87fc5273bc406b0073000119ddcaff6ad86dc59e13d766ca81caf67 |