From a3b0bb610c9585813bc083db8ffb216a86c06246 Mon Sep 17 00:00:00 2001 From: hjc981024 <450342251@qq.com> Date: Tue, 12 Feb 2019 17:23:51 +0800 Subject: [PATCH 1/2] uograde cloghandler to concurrent_log_handler --- cobra/log.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cobra/log.py b/cobra/log.py index cd27fb22..7d3cffc2 100644 --- a/cobra/log.py +++ b/cobra/log.py @@ -16,7 +16,7 @@ import re import subprocess import logging -import cloghandler +import concurrent_log_handler # stream handle # @@ -228,7 +228,7 @@ def format(self, record): logger.addHandler(sh) # file handle -fh = cloghandler.ConcurrentRotatingFileHandler(logfile, maxBytes=(1048576 * 5), backupCount=7) +fh = concurrent_log_handler.ConcurrentRotatingFileHandler(logfile, maxBytes=(1048576 * 5), backupCount=7) fh.setFormatter(fh_format) fh.setLevel(logging.DEBUG) logger.addHandler(fh) From d9473f4af1e85390d9ff571f60ee965753232edb Mon Sep 17 00:00:00 2001 From: hjc981024 <450342251@qq.com> Date: Tue, 12 Feb 2019 17:42:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=94=B9=E8=BF=9BWindows=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在windows环境下,创建目录位置更改为cobra项目路径/tmp --- cobra/config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cobra/config.py b/cobra/config.py index 10f54d3a..54dd9b83 100644 --- a/cobra/config.py +++ b/cobra/config.py @@ -14,6 +14,7 @@ import os import traceback from .log import logger +import sys try: from configparser import ConfigParser @@ -22,7 +23,10 @@ project_directory = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) -code_path = '/tmp/cobra' +if sys.platform == 'win32': + code_path = sys.path[0]+'/tmp'#在cobra项目文件夹下创建目录 +else: + code_path = '/tmp/cobra' if os.path.isdir(code_path) is not True: os.mkdir(code_path)