LogFly 2.2__tar.gz → 2.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: logfly
3
- Version: 2.2
3
+ Version: 2.3
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.2
18
+ # logfly 2.3
19
19
  ### a simple log tool by python.
20
20
 
21
21
  ## position
@@ -1,4 +1,4 @@
1
- # logfly 2.2
1
+ # logfly 2.3
2
2
  ### a simple log tool by python.
3
3
 
4
4
  ## position
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="logfly",
8
- version="2.2",
8
+ version="2.3",
9
9
  author="Yuan Sui",
10
10
  author_email="orisui@icloud.com",
11
11
  description="A simple log tool by python",
@@ -1,16 +1,25 @@
1
1
  #####################
2
2
  # Author: Yuki Sui
3
- # Date: 2022-3-16
3
+ # Date: 2022-4-1
4
4
  #####################
5
5
 
6
6
  import time
7
7
  import shutil
8
8
  import os
9
9
  from pathlib import Path
10
- from colorama import init
10
+ try:
11
+ from colorama import init
12
+ __colorama_init__ = True
13
+ except Exception:
14
+ __colorama_init__ = False
15
+ pass
11
16
 
12
- init(autoreset=True)
13
- __version__ = '2.2'
17
+ if __colorama_init__ == True:
18
+ init(autoreset=True)
19
+ else:
20
+ pass
21
+
22
+ __version__ = '2.3'
14
23
 
15
24
 
16
25
  def create_or_check_file(pathorfile, name, warning='yes'):
@@ -136,14 +145,17 @@ 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 str.upper(level) == 'INFO':
140
- print(f'\033[0;34m{LogFlyMessage}\033[0m')
141
- elif str.upper(level) == 'WARNING':
142
- print(f'\033[0;33m{LogFlyMessage}\033[0m')
143
- elif str.upper(level) == 'ERROR':
144
- print(f'\033[0;31m{LogFlyMessage}\033[0m')
148
+ if __colorama_init__ == True:
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
+ else:
156
+ print(f'\033[0;37m{LogFlyMessage}\033[0m')
145
157
  else:
146
- print(f'\033[0;37m{LogFlyMessage}\033[0m')
158
+ print(LogFlyMessage)
147
159
  else:
148
160
  mesg = str(message) + '\r\n\r\n'
149
161
  print(mesg)
@@ -183,14 +195,17 @@ def write_log(name, position, level, message, mode='add',
183
195
  elif color == 'yes':
184
196
  LogFlyMessage = name + ' ' + get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + \
185
197
  '\r\n '
186
- if str.upper(level) == 'INFO':
187
- print(f'\033[0;34m{LogFlyMessage}\033[0m')
188
- elif str.upper(level) == 'WARNING':
189
- print(f'\033[0;33m{LogFlyMessage}\033[0m')
190
- elif str.upper(level) == 'ERROR':
191
- print(f'\033[0;31m{LogFlyMessage}\033[0m')
198
+ if __colorama_init__ == True:
199
+ if str.upper(level) == 'INFO':
200
+ print(f'\033[0;34m{LogFlyMessage}\033[0m')
201
+ elif str.upper(level) == 'WARNING':
202
+ print(f'\033[0;33m{LogFlyMessage}\033[0m')
203
+ elif str.upper(level) == 'ERROR':
204
+ print(f'\033[0;31m{LogFlyMessage}\033[0m')
205
+ else:
206
+ print(f'\033[0;37m{LogFlyMessage}\033[0m')
192
207
  else:
193
- print(f'\033[0;37m{LogFlyMessage}\033[0m')
208
+ print(LogFlyMessage)
194
209
  else:
195
210
  mesg = str(message) + '\r\n\r\n'
196
211
  print(mesg)
@@ -259,4 +274,4 @@ class ParameterERROR(Exception):
259
274
 
260
275
 
261
276
  if __name__ == '__main__':
262
- write_log('logfly-log', 'fileCLI', 'error', 'test', hidden='yes')
277
+ write_log('logfly-log', 'CLI', 'error', 'test', hidden='yes')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: logfly
3
- Version: 2.2
3
+ Version: 2.3
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.2
18
+ # logfly 2.3
19
19
  ### a simple log tool by python.
20
20
 
21
21
  ## position
File without changes
File without changes
File without changes