LogFly 1.9__tar.gz → 2.0__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-1.9/src/logfly.egg-info → logfly-2.0}/PKG-INFO +13 -13
- {logfly-1.9 → logfly-2.0}/README.md +12 -12
- {logfly-1.9 → logfly-2.0}/setup.py +1 -1
- {logfly-1.9 → logfly-2.0}/src/logfly/__init__.py +30 -9
- {logfly-1.9 → logfly-2.0/src/logfly.egg-info}/PKG-INFO +13 -13
- {logfly-1.9 → logfly-2.0}/LICENSE +0 -0
- {logfly-1.9 → logfly-2.0}/pyproject.toml +0 -0
- {logfly-1.9 → logfly-2.0}/setup.cfg +0 -0
- {logfly-1.9 → logfly-2.0}/src/logfly.egg-info/SOURCES.txt +0 -0
- {logfly-1.9 → logfly-2.0}/src/logfly.egg-info/dependency_links.txt +0 -0
- {logfly-1.9 → logfly-2.0}/src/logfly.egg-info/requires.txt +0 -0
- {logfly-1.9 → logfly-2.0}/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:
|
|
3
|
+
Version: 2.0
|
|
4
4
|
Summary: A simple log tool by python
|
|
5
5
|
Home-page: https://about.guki.me
|
|
6
6
|
Author: Yuan Sui
|
|
@@ -15,20 +15,20 @@ Requires-Python: >=3.6
|
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
17
|
|
|
18
|
-
# logfly
|
|
19
|
-
### a simple log tool by python
|
|
18
|
+
# logfly 2.0
|
|
19
|
+
### a simple log tool by python.
|
|
20
20
|
|
|
21
21
|
## position
|
|
22
22
|
log will create in ./logs/[folder_name]/[date] folder.
|
|
23
|
-
if use hidden, log will also appear in user/.1o9f1y folder
|
|
23
|
+
if use hidden, log will also appear in user/.1o9f1y folder.
|
|
24
24
|
|
|
25
25
|
## How to
|
|
26
26
|
### import
|
|
27
27
|
import logfly
|
|
28
|
-
###
|
|
28
|
+
### write log
|
|
29
29
|
logfly.write_log('name', 'where', 'info', 'message', mode='add', folder_name='logflys', hidden='no', color='yes', str_message='yes')
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
#### Description
|
|
32
32
|
name: (any str) logfile name, you can use diffrent string to create diffrent logfile.
|
|
33
33
|
where: ('CLI', 'fileCLI', 'file') position where log appear.
|
|
34
34
|
fileCLI means log will appear in command line window and log file.
|
|
@@ -43,15 +43,15 @@ if use hidden, log will also appear in user/.1o9f1y folder
|
|
|
43
43
|
color: ('yes', 'no') default is 'yes', means log will with color.
|
|
44
44
|
str_message: ('yes', 'no') default is 'yes', means log will print message with str()
|
|
45
45
|
|
|
46
|
-
###use2
|
|
47
|
-
|
|
46
|
+
### use2
|
|
47
|
+
create_or_check_file(pathorfile, name, warning='yes'):
|
|
48
48
|
create or check file.
|
|
49
|
-
pathorfile: (
|
|
49
|
+
pathorfile: ('file', 'path') choose to create file or path.
|
|
50
50
|
name: (any str) file or path name.
|
|
51
|
-
if warning is '
|
|
51
|
+
if warning is 'yes', will print warning message if file or path is exist.
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
pathfile is the file path that you want to create, must fill with //
|
|
55
|
-
filenname is the file name that you want to create, must is with *.*
|
|
53
|
+
#### Description
|
|
54
|
+
pathfile is the file path that you want to create, must fill with '//'
|
|
55
|
+
filenname is the file name that you want to create, must is with '*.*'
|
|
56
56
|
|
|
57
57
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
# logfly
|
|
2
|
-
### a simple log tool by python
|
|
1
|
+
# logfly 2.0
|
|
2
|
+
### a simple log tool by python.
|
|
3
3
|
|
|
4
4
|
## position
|
|
5
5
|
log will create in ./logs/[folder_name]/[date] folder.
|
|
6
|
-
if use hidden, log will also appear in user/.1o9f1y folder
|
|
6
|
+
if use hidden, log will also appear in user/.1o9f1y folder.
|
|
7
7
|
|
|
8
8
|
## How to
|
|
9
9
|
### import
|
|
10
10
|
import logfly
|
|
11
|
-
###
|
|
11
|
+
### write log
|
|
12
12
|
logfly.write_log('name', 'where', 'info', 'message', mode='add', folder_name='logflys', hidden='no', color='yes', str_message='yes')
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
#### Description
|
|
15
15
|
name: (any str) logfile name, you can use diffrent string to create diffrent logfile.
|
|
16
16
|
where: ('CLI', 'fileCLI', 'file') position where log appear.
|
|
17
17
|
fileCLI means log will appear in command line window and log file.
|
|
@@ -26,13 +26,13 @@ if use hidden, log will also appear in user/.1o9f1y folder
|
|
|
26
26
|
color: ('yes', 'no') default is 'yes', means log will with color.
|
|
27
27
|
str_message: ('yes', 'no') default is 'yes', means log will print message with str()
|
|
28
28
|
|
|
29
|
-
###use2
|
|
30
|
-
|
|
29
|
+
### use2
|
|
30
|
+
create_or_check_file(pathorfile, name, warning='yes'):
|
|
31
31
|
create or check file.
|
|
32
|
-
pathorfile: (
|
|
32
|
+
pathorfile: ('file', 'path') choose to create file or path.
|
|
33
33
|
name: (any str) file or path name.
|
|
34
|
-
if warning is '
|
|
34
|
+
if warning is 'yes', will print warning message if file or path is exist.
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
pathfile is the file path that you want to create, must fill with //
|
|
38
|
-
filenname is the file name that you want to create, must is with *.*
|
|
36
|
+
#### Description
|
|
37
|
+
pathfile is the file path that you want to create, must fill with '//'
|
|
38
|
+
filenname is the file name that you want to create, must is with '*.*'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#####################
|
|
2
2
|
# Author: Yuki Sui
|
|
3
|
-
# Date: 2022-
|
|
3
|
+
# Date: 2022-3-4
|
|
4
4
|
#####################
|
|
5
5
|
|
|
6
6
|
import time
|
|
@@ -10,10 +10,10 @@ from pathlib import Path
|
|
|
10
10
|
from colorama import init
|
|
11
11
|
|
|
12
12
|
init(autoreset=True)
|
|
13
|
-
__version__ = '
|
|
13
|
+
__version__ = '2.0'
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
def create_or_check_file(pathorfile, name, warning='
|
|
16
|
+
def create_or_check_file(pathorfile, name, warning='yes'):
|
|
17
17
|
try:
|
|
18
18
|
if pathorfile == 'file':
|
|
19
19
|
if not os.path.exists(name):
|
|
@@ -34,7 +34,8 @@ def create_or_check_file(pathorfile, name, warning='Yes'):
|
|
|
34
34
|
else:
|
|
35
35
|
raise ParameterERROR('function create_or_check_file Parameter error! warning must be "yes" or "no"! ')
|
|
36
36
|
except Exception as e:
|
|
37
|
-
|
|
37
|
+
linenum = e.__traceback__.tb_lineno
|
|
38
|
+
error(e, linenum)
|
|
38
39
|
|
|
39
40
|
|
|
40
41
|
def create_log_folder(folder_name, hidden):
|
|
@@ -72,7 +73,27 @@ def get_time(flag):
|
|
|
72
73
|
raise ParameterERROR('function get_time Parameter error! flag must be "datetime", "date", "times", '
|
|
73
74
|
'"datetimefile","timestamp"! ')
|
|
74
75
|
except Exception as e:
|
|
75
|
-
|
|
76
|
+
linenum = e.__traceback__.tb_lineno
|
|
77
|
+
error(e, linenum)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def time_transfer(time_stamp, flag='timestamp2datetime'):
|
|
81
|
+
try:
|
|
82
|
+
if flag == 'timestamp2datetime':
|
|
83
|
+
if len(str(time_stamp)) == 10:
|
|
84
|
+
return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time_stamp))
|
|
85
|
+
elif len(str(time_stamp)) == 13:
|
|
86
|
+
return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time_stamp / 1000))
|
|
87
|
+
else:
|
|
88
|
+
raise ParameterERROR('function time_transfer Parameter error! time_stamp must be 10 bits or 13 bits! ')
|
|
89
|
+
elif flag == 'datetime2timestamp':
|
|
90
|
+
return time.mktime(time.strptime(time_stamp, "%Y-%m-%d %H:%M:%S"))
|
|
91
|
+
else:
|
|
92
|
+
raise ParameterERROR('function time_transfer Parameter error! flag must be "timestamp2datetime" or '
|
|
93
|
+
'"datetime2timestamp"! ')
|
|
94
|
+
except Exception as e:
|
|
95
|
+
linenum = e.__traceback__.tb_lineno
|
|
96
|
+
error(e, linenum)
|
|
76
97
|
|
|
77
98
|
|
|
78
99
|
# noinspection PyTypeChecker
|
|
@@ -188,7 +209,8 @@ def write_log(name, position, level, message, mode='add',
|
|
|
188
209
|
else:
|
|
189
210
|
raise ParameterERROR('function write_log Parameter error! position must be "file" or "fileCLI"! ')
|
|
190
211
|
except Exception as e:
|
|
191
|
-
|
|
212
|
+
linenum = e.__traceback__.tb_lineno
|
|
213
|
+
error(e, linenum, 'only print')
|
|
192
214
|
|
|
193
215
|
|
|
194
216
|
def mv_file(original_file_name, new_file_name, folder_name='mv_file'):
|
|
@@ -197,9 +219,9 @@ def mv_file(original_file_name, new_file_name, folder_name='mv_file'):
|
|
|
197
219
|
write_log('logfly-log', 'CLI', 'error', message, folder_name=folder_name)
|
|
198
220
|
|
|
199
221
|
|
|
200
|
-
def error(exp, mode='logfly'):
|
|
222
|
+
def error(exp,linenum, mode='logfly'):
|
|
201
223
|
if mode == 'logfly':
|
|
202
|
-
logflyErrorMessage = 'ERROR occurred
|
|
224
|
+
logflyErrorMessage = 'ERROR occurred! at row ' + str(linenum) + '\r\n\r\n' + str(
|
|
203
225
|
exp) + "\r\n\r\nplease re-check it! \r\nAnd you can see the " \
|
|
204
226
|
"manual at " \
|
|
205
227
|
"https://github.com/tinqlo/logfly "
|
|
@@ -213,4 +235,3 @@ def error(exp, mode='logfly'):
|
|
|
213
235
|
class ParameterERROR(Exception):
|
|
214
236
|
def __init__(self, message):
|
|
215
237
|
self.message = message
|
|
216
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: logfly
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0
|
|
4
4
|
Summary: A simple log tool by python
|
|
5
5
|
Home-page: https://about.guki.me
|
|
6
6
|
Author: Yuan Sui
|
|
@@ -15,20 +15,20 @@ Requires-Python: >=3.6
|
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
17
|
|
|
18
|
-
# logfly
|
|
19
|
-
### a simple log tool by python
|
|
18
|
+
# logfly 2.0
|
|
19
|
+
### a simple log tool by python.
|
|
20
20
|
|
|
21
21
|
## position
|
|
22
22
|
log will create in ./logs/[folder_name]/[date] folder.
|
|
23
|
-
if use hidden, log will also appear in user/.1o9f1y folder
|
|
23
|
+
if use hidden, log will also appear in user/.1o9f1y folder.
|
|
24
24
|
|
|
25
25
|
## How to
|
|
26
26
|
### import
|
|
27
27
|
import logfly
|
|
28
|
-
###
|
|
28
|
+
### write log
|
|
29
29
|
logfly.write_log('name', 'where', 'info', 'message', mode='add', folder_name='logflys', hidden='no', color='yes', str_message='yes')
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
#### Description
|
|
32
32
|
name: (any str) logfile name, you can use diffrent string to create diffrent logfile.
|
|
33
33
|
where: ('CLI', 'fileCLI', 'file') position where log appear.
|
|
34
34
|
fileCLI means log will appear in command line window and log file.
|
|
@@ -43,15 +43,15 @@ if use hidden, log will also appear in user/.1o9f1y folder
|
|
|
43
43
|
color: ('yes', 'no') default is 'yes', means log will with color.
|
|
44
44
|
str_message: ('yes', 'no') default is 'yes', means log will print message with str()
|
|
45
45
|
|
|
46
|
-
###use2
|
|
47
|
-
|
|
46
|
+
### use2
|
|
47
|
+
create_or_check_file(pathorfile, name, warning='yes'):
|
|
48
48
|
create or check file.
|
|
49
|
-
pathorfile: (
|
|
49
|
+
pathorfile: ('file', 'path') choose to create file or path.
|
|
50
50
|
name: (any str) file or path name.
|
|
51
|
-
if warning is '
|
|
51
|
+
if warning is 'yes', will print warning message if file or path is exist.
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
pathfile is the file path that you want to create, must fill with //
|
|
55
|
-
filenname is the file name that you want to create, must is with *.*
|
|
53
|
+
#### Description
|
|
54
|
+
pathfile is the file path that you want to create, must fill with '//'
|
|
55
|
+
filenname is the file name that you want to create, must is with '*.*'
|
|
56
56
|
|
|
57
57
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|