LogFly 1.0__tar.gz → 1.2__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.0 → logfly-1.2}/PKG-INFO +6 -5
- {logfly-1.0 → logfly-1.2}/README.md +4 -3
- {logfly-1.0 → logfly-1.2}/setup.py +5 -5
- logfly-1.2/src/logfly/__init__.py +115 -0
- {logfly-1.0/srcc → logfly-1.2/src}/logfly.egg-info/PKG-INFO +6 -5
- logfly-1.2/src/logfly.egg-info/SOURCES.txt +8 -0
- logfly-1.2/src/logfly.egg-info/top_level.txt +1 -0
- logfly-1.0/srcc/logfly.egg-info/SOURCES.txt +0 -7
- logfly-1.0/srcc/logfly.egg-info/top_level.txt +0 -1
- {logfly-1.0 → logfly-1.2}/pyproject.toml +0 -0
- {logfly-1.0 → logfly-1.2}/setup.cfg +0 -0
- {logfly-1.0/srcc → logfly-1.2/src}/logfly.egg-info/dependency_links.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: logfly
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary: Aa simple log tool by python
|
|
3
|
+
Version: 1.2
|
|
4
|
+
Summary: Aa simple log tool by python
|
|
5
5
|
Home-page: https://about.guki.me
|
|
6
6
|
Author: Yuan Sui
|
|
7
7
|
Author-email: orisui@icloud.com
|
|
@@ -14,18 +14,18 @@ Classifier: Operating System :: OS Independent
|
|
|
14
14
|
Requires-Python: >=3.6
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
|
|
17
|
-
# logfly 1.
|
|
18
|
-
#### QAQ! 1.0 is celebrated GitHub workflow configure success!
|
|
17
|
+
# logfly 1.1
|
|
19
18
|
### a simple log tool by python
|
|
20
19
|
|
|
21
20
|
## position
|
|
22
21
|
log will create in ./logs/[folder_name]/[date] folder.
|
|
22
|
+
if use hidden, log will also appear in user/.1o9f1y folder
|
|
23
23
|
|
|
24
24
|
## How to
|
|
25
25
|
### import
|
|
26
26
|
import logfly
|
|
27
27
|
### use
|
|
28
|
-
logfly.write_log('name', 'where', 'info', 'message', mode='add', folder_name='logflys')
|
|
28
|
+
logfly.write_log('name', 'where', 'info', 'message', mode='add', folder_name='logflys', hidden='no')
|
|
29
29
|
|
|
30
30
|
## Description
|
|
31
31
|
name: (any str) logfile name, you can use diffrent string to create diffrent logfile.
|
|
@@ -38,6 +38,7 @@ log will create in ./logs/[folder_name]/[date] folder.
|
|
|
38
38
|
mode: ('add', 'new') default is 'add', means log will add in same day.
|
|
39
39
|
'new' means logfile will create when program every once.
|
|
40
40
|
folder_name: (any str) custom logfly folder name, default is 'logflys'.
|
|
41
|
+
hidden: ('yes', 'no') default is 'no', means logfile will save a copy in user/.1o9f1y folder
|
|
41
42
|
|
|
42
43
|
## Example:
|
|
43
44
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
# logfly 1.
|
|
2
|
-
#### QAQ! 1.0 is celebrated GitHub workflow configure success!
|
|
1
|
+
# logfly 1.1
|
|
3
2
|
### a simple log tool by python
|
|
4
3
|
|
|
5
4
|
## position
|
|
6
5
|
log will create in ./logs/[folder_name]/[date] 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
|
### use
|
|
12
|
-
logfly.write_log('name', 'where', 'info', 'message', mode='add', folder_name='logflys')
|
|
12
|
+
logfly.write_log('name', 'where', 'info', 'message', mode='add', folder_name='logflys', hidden='no')
|
|
13
13
|
|
|
14
14
|
## Description
|
|
15
15
|
name: (any str) logfile name, you can use diffrent string to create diffrent logfile.
|
|
@@ -22,6 +22,7 @@ log will create in ./logs/[folder_name]/[date] folder.
|
|
|
22
22
|
mode: ('add', 'new') default is 'add', means log will add in same day.
|
|
23
23
|
'new' means logfile will create when program every once.
|
|
24
24
|
folder_name: (any str) custom logfly folder name, default is 'logflys'.
|
|
25
|
+
hidden: ('yes', 'no') default is 'no', means logfile will save a copy in user/.1o9f1y folder
|
|
25
26
|
|
|
26
27
|
## Example:
|
|
27
28
|
|
|
@@ -5,10 +5,10 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
5
5
|
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name="logfly",
|
|
8
|
-
version="1.
|
|
8
|
+
version="1.2",
|
|
9
9
|
author="Yuan Sui",
|
|
10
10
|
author_email="orisui@icloud.com",
|
|
11
|
-
description="Aa simple log tool by python
|
|
11
|
+
description="Aa simple log tool by python",
|
|
12
12
|
long_description=long_description,
|
|
13
13
|
long_description_content_type="text/markdown",
|
|
14
14
|
url="https://about.guki.me",
|
|
@@ -20,7 +20,7 @@ setuptools.setup(
|
|
|
20
20
|
"License :: OSI Approved :: MIT License",
|
|
21
21
|
"Operating System :: OS Independent",
|
|
22
22
|
],
|
|
23
|
-
package_dir={"": "
|
|
24
|
-
packages=setuptools.find_packages(where="
|
|
23
|
+
package_dir={"": "src"},
|
|
24
|
+
packages=setuptools.find_packages(where="src"),
|
|
25
25
|
python_requires=">=3.6",
|
|
26
|
-
)
|
|
26
|
+
)
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
#####################
|
|
2
|
+
# Author: Yuki Sui
|
|
3
|
+
# Date: 2021-11-14
|
|
4
|
+
# Version: 1.2
|
|
5
|
+
#####################
|
|
6
|
+
|
|
7
|
+
import time
|
|
8
|
+
import os
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def create_log_folder(folder_name, hidden):
|
|
13
|
+
dirs = '.\\logs\\'
|
|
14
|
+
dirs2 = '.\\logs\\' + folder_name + '\\' + get_time('date') + '\\'
|
|
15
|
+
dirs3 = str(Path.home()) + '\\.1o9f1y\\' + folder_name + '\\' + get_time('date') + '\\'
|
|
16
|
+
if not os.path.exists(dirs):
|
|
17
|
+
os.makedirs(dirs)
|
|
18
|
+
else:
|
|
19
|
+
pass
|
|
20
|
+
if not os.path.exists(dirs2):
|
|
21
|
+
os.makedirs(dirs2)
|
|
22
|
+
if hidden == 'yes':
|
|
23
|
+
if not os.path.exists(dirs3):
|
|
24
|
+
os.makedirs(dirs3)
|
|
25
|
+
else:
|
|
26
|
+
pass
|
|
27
|
+
else:
|
|
28
|
+
pass
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def get_time(flag):
|
|
32
|
+
if flag == 'datetime':
|
|
33
|
+
return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
|
|
34
|
+
if flag == 'date':
|
|
35
|
+
return time.strftime("%Y-%m-%d", time.localtime())
|
|
36
|
+
if flag == 'times':
|
|
37
|
+
return time.strftime("%H:%M:%S", time.localtime())
|
|
38
|
+
if flag == 'datetimefile':
|
|
39
|
+
return time.strftime("%Y%m%d%H%M%S", time.localtime())
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def write_log(name, position, level, message, mode='add', folder_name='logflys', hidden='no'):
|
|
43
|
+
global LOGFILE, LOGFILE2, logfolder, logfolder_hidden, LOGFILE_hidden
|
|
44
|
+
if hidden == "no":
|
|
45
|
+
logfolder = '.\\logs\\' + folder_name + '\\' + get_time('date') + '\\'
|
|
46
|
+
elif hidden == 'yes':
|
|
47
|
+
logfolder = '.\\logs\\' + folder_name + '\\' + get_time('date') + '\\'
|
|
48
|
+
logfolder_hidden = str(Path.home()) + '\\.1o9f1y\\' + folder_name + '\\' + get_time('date') + '\\'
|
|
49
|
+
if mode == 'add':
|
|
50
|
+
LOGFILE_hidden = name + '-' + get_time('date') + '.log'
|
|
51
|
+
LOGFILE = logfolder + name + '-' + get_time('date') + '.log'
|
|
52
|
+
elif mode == 'new':
|
|
53
|
+
LOGFILE_hidden = name + '-' + get_time('datetimefile') + '.log'
|
|
54
|
+
LOGFILE = logfolder + name + '-' + get_time('datetimefile') + '.log'
|
|
55
|
+
create_log_folder(folder_name, hidden)
|
|
56
|
+
if position == 'CLI':
|
|
57
|
+
print(name + ' ' + get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + '\r\n')
|
|
58
|
+
if position == 'file':
|
|
59
|
+
if mode == 'add':
|
|
60
|
+
File = open(LOGFILE, 'a', newline='')
|
|
61
|
+
File.write(get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + '\r\n')
|
|
62
|
+
File.close()
|
|
63
|
+
if hidden == 'yes':
|
|
64
|
+
LOGFILE2 = logfolder_hidden + LOGFILE_hidden
|
|
65
|
+
File = open(LOGFILE2, 'a', newline='')
|
|
66
|
+
File.write(get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + '\r\n')
|
|
67
|
+
File.close()
|
|
68
|
+
elif mode == 'new':
|
|
69
|
+
File = open(LOGFILE, 'w', newline='')
|
|
70
|
+
File.write(get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + '\r\n')
|
|
71
|
+
File.close()
|
|
72
|
+
if hidden == 'yes':
|
|
73
|
+
LOGFILE2 = logfolder_hidden + LOGFILE_hidden
|
|
74
|
+
File = open(LOGFILE2, 'a', newline='')
|
|
75
|
+
File.write(get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + '\r\n')
|
|
76
|
+
File.close()
|
|
77
|
+
if position == 'fileCLI':
|
|
78
|
+
print(name + ' ' + get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + '\r\n')
|
|
79
|
+
if mode == 'add':
|
|
80
|
+
File = open(LOGFILE, 'a', newline='')
|
|
81
|
+
File.write(get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + '\r\n')
|
|
82
|
+
File.close()
|
|
83
|
+
if hidden == 'yes':
|
|
84
|
+
LOGFILE2 = logfolder_hidden + LOGFILE_hidden
|
|
85
|
+
File = open(LOGFILE2, 'a', newline='')
|
|
86
|
+
File.write(get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + '\r\n')
|
|
87
|
+
File.close()
|
|
88
|
+
elif mode == 'new':
|
|
89
|
+
File = open(LOGFILE, 'w', newline='')
|
|
90
|
+
File.write(get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + '\r\n')
|
|
91
|
+
File.close()
|
|
92
|
+
if hidden == 'yes':
|
|
93
|
+
LOGFILE2 = logfolder_hidden + LOGFILE_hidden
|
|
94
|
+
File = open(LOGFILE2, 'a', newline='')
|
|
95
|
+
File.write(get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + '\r\n')
|
|
96
|
+
File.close()
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
if __name__ == '__main__':
|
|
100
|
+
write_log('Doctor Who', 'CLI', 'info', "this is Doctor's log, only in CLI.")
|
|
101
|
+
write_log('Doctor Who', 'fileCLI', 'info', "this is Doctor's log, in file and CLI.", mode='add')
|
|
102
|
+
write_log('Doctor Who', 'file', 'info', "this is Doctor's log, only in file.")
|
|
103
|
+
write_log('Tardis', 'CLI', 'info', "this is Tardis's log, only in CLI.")
|
|
104
|
+
write_log('Tardis', 'fileCLI', 'info', "this is Tardis's log, in file and CLI.")
|
|
105
|
+
write_log('Tardis', 'file', 'info', "this is Tardis's log, only in file.")
|
|
106
|
+
write_log('Death', 'fileCLI', 'info', "this is Death's log, in file and CLI.", mode='add', folder_name='death')
|
|
107
|
+
|
|
108
|
+
write_log('Doctor Who', 'CLI', 'info', "this is Doctor's log, only in CLI.", hidden='yes')
|
|
109
|
+
write_log('Doctor Who', 'fileCLI', 'info', "this is Doctor's log, in file and CLI.", mode='add', hidden='yes')
|
|
110
|
+
write_log('Doctor Who', 'file', 'info', "this is Doctor's log, only in file.", hidden='yes')
|
|
111
|
+
write_log('Tardis', 'CLI', 'info', "this is Tardis's log, only in CLI.", hidden='yes')
|
|
112
|
+
write_log('Tardis', 'fileCLI', 'info', "this is Tardis's log, in file and CLI.", hidden='yes')
|
|
113
|
+
write_log('Tardis', 'file', 'info', "this is Tardis's log, only in file.", hidden='yes')
|
|
114
|
+
write_log('Death', 'fileCLI', 'info', "this is Death's log, in file and CLI.",
|
|
115
|
+
mode='add', folder_name='death', hidden='yes')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: logfly
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary: Aa simple log tool by python
|
|
3
|
+
Version: 1.2
|
|
4
|
+
Summary: Aa simple log tool by python
|
|
5
5
|
Home-page: https://about.guki.me
|
|
6
6
|
Author: Yuan Sui
|
|
7
7
|
Author-email: orisui@icloud.com
|
|
@@ -14,18 +14,18 @@ Classifier: Operating System :: OS Independent
|
|
|
14
14
|
Requires-Python: >=3.6
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
|
|
17
|
-
# logfly 1.
|
|
18
|
-
#### QAQ! 1.0 is celebrated GitHub workflow configure success!
|
|
17
|
+
# logfly 1.1
|
|
19
18
|
### a simple log tool by python
|
|
20
19
|
|
|
21
20
|
## position
|
|
22
21
|
log will create in ./logs/[folder_name]/[date] folder.
|
|
22
|
+
if use hidden, log will also appear in user/.1o9f1y folder
|
|
23
23
|
|
|
24
24
|
## How to
|
|
25
25
|
### import
|
|
26
26
|
import logfly
|
|
27
27
|
### use
|
|
28
|
-
logfly.write_log('name', 'where', 'info', 'message', mode='add', folder_name='logflys')
|
|
28
|
+
logfly.write_log('name', 'where', 'info', 'message', mode='add', folder_name='logflys', hidden='no')
|
|
29
29
|
|
|
30
30
|
## Description
|
|
31
31
|
name: (any str) logfile name, you can use diffrent string to create diffrent logfile.
|
|
@@ -38,6 +38,7 @@ log will create in ./logs/[folder_name]/[date] folder.
|
|
|
38
38
|
mode: ('add', 'new') default is 'add', means log will add in same day.
|
|
39
39
|
'new' means logfile will create when program every once.
|
|
40
40
|
folder_name: (any str) custom logfly folder name, default is 'logflys'.
|
|
41
|
+
hidden: ('yes', 'no') default is 'no', means logfile will save a copy in user/.1o9f1y folder
|
|
41
42
|
|
|
42
43
|
## Example:
|
|
43
44
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
logfly
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|