LogFly 2.2__tar.gz → 2.4__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.
- {logfly-2.2/src/logfly.egg-info → logfly-2.4}/PKG-INFO +2 -2
- {logfly-2.2 → logfly-2.4}/README.md +1 -1
- {logfly-2.2 → logfly-2.4}/setup.py +1 -1
- {logfly-2.2 → logfly-2.4}/src/logfly/__init__.py +38 -19
- {logfly-2.2 → logfly-2.4/src/logfly.egg-info}/PKG-INFO +2 -2
- {logfly-2.2 → logfly-2.4}/LICENSE +0 -0
- {logfly-2.2 → logfly-2.4}/pyproject.toml +0 -0
- {logfly-2.2 → logfly-2.4}/setup.cfg +0 -0
- {logfly-2.2 → logfly-2.4}/src/logfly.egg-info/SOURCES.txt +0 -0
- {logfly-2.2 → logfly-2.4}/src/logfly.egg-info/dependency_links.txt +0 -0
- {logfly-2.2 → logfly-2.4}/src/logfly.egg-info/requires.txt +0 -0
- {logfly-2.2 → logfly-2.4}/src/logfly.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: logfly
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4
|
|
4
4
|
Summary: A simple log tool by python
|
|
5
5
|
Home-page: https://about.guki.me
|
|
6
6
|
Author: Yuan Sui
|
|
@@ -15,7 +15,7 @@ Requires-Python: >=3.6
|
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
17
|
|
|
18
|
-
# logfly 2.
|
|
18
|
+
# logfly 2.4
|
|
19
19
|
### a simple log tool by python.
|
|
20
20
|
|
|
21
21
|
## position
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
#####################
|
|
2
2
|
# Author: Yuki Sui
|
|
3
|
-
# Date: 2022-
|
|
3
|
+
# Date: 2022-5-1
|
|
4
4
|
#####################
|
|
5
5
|
|
|
6
6
|
import time
|
|
7
7
|
import shutil
|
|
8
8
|
import os
|
|
9
9
|
from pathlib import Path
|
|
10
|
-
|
|
10
|
+
try:
|
|
11
|
+
from colorama import init
|
|
12
|
+
__colorama_init__ = True
|
|
13
|
+
except ModuleNotFoundError:
|
|
14
|
+
__colorama_init__ = False
|
|
15
|
+
pass
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
if __colorama_init__:
|
|
18
|
+
init(autoreset=True)
|
|
19
|
+
else:
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
__version__ = '2.4'
|
|
14
23
|
|
|
15
24
|
|
|
16
25
|
def create_or_check_file(pathorfile, name, warning='yes'):
|
|
@@ -136,14 +145,19 @@ def write_log(name, position, level, message, mode='add',
|
|
|
136
145
|
elif color == 'yes':
|
|
137
146
|
LogFlyMessage = name + ' ' + get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + \
|
|
138
147
|
'\r\n '
|
|
139
|
-
if
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
148
|
+
if __colorama_init__:
|
|
149
|
+
if str.upper(level) == 'INFO':
|
|
150
|
+
print(f'\033[0;34m{LogFlyMessage}\033[0m')
|
|
151
|
+
elif str.upper(level) == 'WARNING':
|
|
152
|
+
print(f'\033[0;33m{LogFlyMessage}\033[0m')
|
|
153
|
+
elif str.upper(level) == 'ERROR':
|
|
154
|
+
print(f'\033[0;31m{LogFlyMessage}\033[0m')
|
|
155
|
+
elif str.upper(level) == 'PASS':
|
|
156
|
+
print(f'\033[0;32m{LogFlyMessage}\033[0m')
|
|
157
|
+
else:
|
|
158
|
+
print(f'\033[0;37m{LogFlyMessage}\033[0m')
|
|
145
159
|
else:
|
|
146
|
-
print(
|
|
160
|
+
print(LogFlyMessage)
|
|
147
161
|
else:
|
|
148
162
|
mesg = str(message) + '\r\n\r\n'
|
|
149
163
|
print(mesg)
|
|
@@ -183,14 +197,19 @@ def write_log(name, position, level, message, mode='add',
|
|
|
183
197
|
elif color == 'yes':
|
|
184
198
|
LogFlyMessage = name + ' ' + get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + \
|
|
185
199
|
'\r\n '
|
|
186
|
-
if
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
200
|
+
if __colorama_init__:
|
|
201
|
+
if str.upper(level) == 'INFO':
|
|
202
|
+
print(f'\033[0;34m{LogFlyMessage}\033[0m')
|
|
203
|
+
elif str.upper(level) == 'WARNING':
|
|
204
|
+
print(f'\033[0;33m{LogFlyMessage}\033[0m')
|
|
205
|
+
elif str.upper(level) == 'ERROR':
|
|
206
|
+
print(f'\033[0;31m{LogFlyMessage}\033[0m')
|
|
207
|
+
elif str.upper(level) == 'PASS':
|
|
208
|
+
print(f'\033[0;32m{LogFlyMessage}\033[0m')
|
|
209
|
+
else:
|
|
210
|
+
print(f'\033[0;37m{LogFlyMessage}\033[0m')
|
|
192
211
|
else:
|
|
193
|
-
print(
|
|
212
|
+
print(LogFlyMessage)
|
|
194
213
|
else:
|
|
195
214
|
mesg = str(message) + '\r\n\r\n'
|
|
196
215
|
print(mesg)
|
|
@@ -259,4 +278,4 @@ class ParameterERROR(Exception):
|
|
|
259
278
|
|
|
260
279
|
|
|
261
280
|
if __name__ == '__main__':
|
|
262
|
-
write_log('logfly-log', '
|
|
281
|
+
write_log('logfly-log', 'CLI', 'pass', 'test', hidden='yes')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: logfly
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4
|
|
4
4
|
Summary: A simple log tool by python
|
|
5
5
|
Home-page: https://about.guki.me
|
|
6
6
|
Author: Yuan Sui
|
|
@@ -15,7 +15,7 @@ Requires-Python: >=3.6
|
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
17
|
|
|
18
|
-
# logfly 2.
|
|
18
|
+
# logfly 2.4
|
|
19
19
|
### a simple log tool by python.
|
|
20
20
|
|
|
21
21
|
## position
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|