cloudoll 2.2.8__tar.gz → 2.2.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cloudoll-2.2.8 → cloudoll-2.2.9}/PKG-INFO +1 -1
- cloudoll-2.2.9/cloudoll/__init__.py +1 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/logging/__init__.py +20 -6
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/orm/__init__.py +12 -8
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/orm/model.py +1 -8
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll.egg-info/PKG-INFO +1 -1
- cloudoll-2.2.8/cloudoll/__init__.py +0 -1
- {cloudoll-2.2.8 → cloudoll-2.2.9}/LICENSE +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/README.md +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/__main__.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/cli.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/error/__init__.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/error/errors.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/mail/__init__.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/mail/smtp.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/orm/base.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/orm/err.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/orm/field.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/orm/mysql.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/orm/parse.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/orm/postgres.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/robot/__init__.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/robot/dingtalk.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/robot/feishu.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/robot/slack.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/utils/__init__.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/utils/common.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/utils/m2d.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/utils/patch_loop.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/utils/watch.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/web/__init__.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/web/exception.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/web/html.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/web/http.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/web/jwt.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/web/settings.py +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll.egg-info/SOURCES.txt +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll.egg-info/dependency_links.txt +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll.egg-info/entry_points.txt +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll.egg-info/requires.txt +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll.egg-info/top_level.txt +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/setup.cfg +0 -0
- {cloudoll-2.2.8 → cloudoll-2.2.9}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.2.9"
|
|
@@ -19,6 +19,7 @@ __ALL__ = (
|
|
|
19
19
|
"critical",
|
|
20
20
|
"print_info",
|
|
21
21
|
"print_error",
|
|
22
|
+
"print_warn",
|
|
22
23
|
)
|
|
23
24
|
_COLORS = {
|
|
24
25
|
# 终端输出日志颜色配置
|
|
@@ -40,9 +41,11 @@ class ColorAnsi:
|
|
|
40
41
|
|
|
41
42
|
_FORMATS = {
|
|
42
43
|
# 终端输出格式
|
|
43
|
-
"console_format": "%(log_color)s[%(levelname)s]-%(asctime)s-%(pathname)s-%(module)s-%(funcName)s-[line:%(lineno)d]: %(message)s",
|
|
44
|
+
# "console_format": "%(log_color)s[%(levelname)s]-%(asctime)s-%(pathname)s-%(module)s-%(funcName)s-[line:%(lineno)d]: %(message)s",
|
|
45
|
+
"console_format": "%(log_color)s%(asctime)s %(levelname)s %(funcName)s %(message)s",
|
|
44
46
|
# 日志输出格式
|
|
45
|
-
"log_format": "[%(levelname)s]-%(asctime)s-%(pathname)s-%(module)s-%(funcName)s-[line:%(lineno)d]: %(message)s",
|
|
47
|
+
# "log_format": "[%(levelname)s]-%(asctime)s-%(pathname)s-%(module)s-%(funcName)s-[line:%(lineno)d]: %(message)s",
|
|
48
|
+
"log_format": "%(asctime)s %(levelname)s %(funcName)s %(message)s",
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
_LOG_SIZE = 1024 * 1024 * 1 # 1MB 日志最大1MB
|
|
@@ -138,12 +141,23 @@ class HandleLog:
|
|
|
138
141
|
_handler = None
|
|
139
142
|
|
|
140
143
|
|
|
141
|
-
def
|
|
142
|
-
|
|
144
|
+
def print_format(color_ansi, type, *args):
|
|
145
|
+
ft = color_ansi + "{}" + ColorAnsi.END
|
|
146
|
+
timestamp = ft.format(datetime.now().strftime("%Y-%m-%d %H:%M:%S") + " " + type)
|
|
147
|
+
text = " ".join(ft.format(str(arg)) for arg in args)
|
|
148
|
+
print(timestamp, text)
|
|
143
149
|
|
|
144
150
|
|
|
145
|
-
def
|
|
146
|
-
|
|
151
|
+
def print_info(*args):
|
|
152
|
+
print_format(ColorAnsi.GREEN, "INFO", *args)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def print_error(*args):
|
|
156
|
+
print_format(ColorAnsi.RED, "ERROR", *args)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def print_warn(*args):
|
|
160
|
+
print_format(ColorAnsi.YELLOW, "WARN", *args)
|
|
147
161
|
|
|
148
162
|
|
|
149
163
|
def _get_handle():
|
|
@@ -3,7 +3,7 @@ from .parse import parse_coon
|
|
|
3
3
|
import aiopg, aiomysql
|
|
4
4
|
from .base import MeteBase, QueryTypes
|
|
5
5
|
from typing import Any
|
|
6
|
-
from ..logging import
|
|
6
|
+
from ..logging import print_info, print_error
|
|
7
7
|
import traceback
|
|
8
8
|
|
|
9
9
|
|
|
@@ -35,7 +35,7 @@ async def create_engine(**kw):
|
|
|
35
35
|
url = f"{driver}://{configs['username']}:{configs['password']}@{configs['host']}:{configs['port']}/{configs['db']}"
|
|
36
36
|
return await aioredis.from_url(url, **query)
|
|
37
37
|
else:
|
|
38
|
-
|
|
38
|
+
print_error("Not suport this database type.")
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
class Postgres(MeteBase):
|
|
@@ -104,11 +104,13 @@ class Postgres(MeteBase):
|
|
|
104
104
|
maxsize=kw.get("maxsize", 10),
|
|
105
105
|
minsize=kw.get("pool_size", 5),
|
|
106
106
|
)
|
|
107
|
-
|
|
107
|
+
print_info(f"Database connection successfuly for postgres/{kw.get('db')}")
|
|
108
108
|
except Exception as e:
|
|
109
|
-
error(e)
|
|
109
|
+
# error(e)
|
|
110
110
|
# print(traceback.format_exc())
|
|
111
|
-
|
|
111
|
+
print_error(
|
|
112
|
+
f"Database connection failed,the instance : postgres/{kw.get('db')}"
|
|
113
|
+
)
|
|
112
114
|
|
|
113
115
|
return self
|
|
114
116
|
|
|
@@ -191,9 +193,11 @@ class Mysql(MeteBase):
|
|
|
191
193
|
cursorclass=AttrDictCursor,
|
|
192
194
|
loop=loop,
|
|
193
195
|
)
|
|
194
|
-
|
|
196
|
+
print_info(f"Database connection successfuly for mysql/{kw.get('db')}.")
|
|
195
197
|
except Exception as e:
|
|
196
|
-
print(e)
|
|
198
|
+
# print(e)
|
|
197
199
|
# print(traceback.format_exc())
|
|
198
|
-
|
|
200
|
+
print_error(
|
|
201
|
+
f"Database connection failed,the instance : mysql/{kw.get('db')}"
|
|
202
|
+
)
|
|
199
203
|
return self
|
|
@@ -72,14 +72,7 @@ class Model(metaclass=ModelMetaclass):
|
|
|
72
72
|
f = getattr(self, k, None)
|
|
73
73
|
f.value = None
|
|
74
74
|
for k, v in kw.items():
|
|
75
|
-
|
|
76
|
-
f = getattr(self, k, None)
|
|
77
|
-
if isinstance(f, Field):
|
|
78
|
-
if v is None:
|
|
79
|
-
v = f.default
|
|
80
|
-
f.value = v
|
|
81
|
-
else:
|
|
82
|
-
setattr(self, k, v)
|
|
75
|
+
self[k] = v
|
|
83
76
|
|
|
84
77
|
# super().__init__(self, **kw)
|
|
85
78
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.2.8"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|