LogFly 0.6__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-0.6/PKG-INFO +66 -0
- logfly-0.6/README.md +54 -0
- logfly-0.6/logfly/__init__.py +66 -0
- logfly-0.6/logfly.egg-info/PKG-INFO +66 -0
- logfly-0.6/logfly.egg-info/SOURCES.txt +7 -0
- logfly-0.6/logfly.egg-info/dependency_links.txt +1 -0
- logfly-0.6/logfly.egg-info/top_level.txt +1 -0
- logfly-0.6/setup.cfg +4 -0
- logfly-0.6/setup.py +17 -0
logfly-0.6/PKG-INFO
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: logfly
|
|
3
|
+
Version: 0.6
|
|
4
|
+
Summary: a simple log tool for python
|
|
5
|
+
Home-page: https://github.com/TinQlo/logfly
|
|
6
|
+
Author: Yuan Sui
|
|
7
|
+
Author-email: orisui@icloud.com
|
|
8
|
+
License: MIT License
|
|
9
|
+
Platform: UNKNOWN
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# logfly
|
|
13
|
+
### a simple log tool for python
|
|
14
|
+
|
|
15
|
+
## position
|
|
16
|
+
log will create in ./logs/[date] folder.
|
|
17
|
+
|
|
18
|
+
## How to
|
|
19
|
+
### import
|
|
20
|
+
import logfly
|
|
21
|
+
### use
|
|
22
|
+
logfly.write_log('name', 'where', 'info', 'message', mode='add')
|
|
23
|
+
|
|
24
|
+
## Description
|
|
25
|
+
name: (any str) logfile name, you can use diffrent string to create diffrent logfile.
|
|
26
|
+
where: ('CLI', 'fileCLI', 'file') position where log appear.
|
|
27
|
+
fileCLI means log will appear in command line window and log file.
|
|
28
|
+
CLI means log will only appear in command line window.
|
|
29
|
+
file means log will only appear in logfile.
|
|
30
|
+
info: (any str) custom log level, will upper and wrap with '[]'.
|
|
31
|
+
message: (any str) log message.
|
|
32
|
+
mode: ('add', 'new') default is 'add', means log will add in same day.
|
|
33
|
+
'new' means logfile will create when program every once.
|
|
34
|
+
|
|
35
|
+
## Example:
|
|
36
|
+
|
|
37
|
+
### both file and CLI code
|
|
38
|
+
logfly.write_log('Doctor Who', 'fileCLI', 'info', "this is Doctor's log, in file and CLI.")
|
|
39
|
+
#### in CLI
|
|
40
|
+
2021-07-29 20:39:07 [INFO] this is Doctor's log, in file and CLI.
|
|
41
|
+
#### in file (Doctor Who-2021-07-29.log)
|
|
42
|
+
2021-07-29 20:39:07 [INFO] this is Doctor's log, in file and CLI.
|
|
43
|
+
|
|
44
|
+
### only in CLI code
|
|
45
|
+
logfly.write_log('Doctor Who', 'CLI', 'info', "this is Doctor's log, only in CLI.")
|
|
46
|
+
#### in CLI
|
|
47
|
+
2021-07-29 20:39:07 [INFO] this is Doctor's log, only in CLI.
|
|
48
|
+
#### in file
|
|
49
|
+
None
|
|
50
|
+
|
|
51
|
+
### only in file code
|
|
52
|
+
logfly.write_log('Doctor Who', 'file', 'info', "this is Doctor's log, in file and CLI.")
|
|
53
|
+
#### in CLI
|
|
54
|
+
None
|
|
55
|
+
#### in file (Doctor Who-2021-07-29.log)
|
|
56
|
+
2021-07-29 20:40:03 [INFO] this is Doctor's log, only in file.
|
|
57
|
+
|
|
58
|
+
#### mode arg:
|
|
59
|
+
logfly.write_log('Doctor Who', 'file', 'info', "this is Doctor's log, in file and CLI.", mode='new')
|
|
60
|
+
#### in CLI:
|
|
61
|
+
2021-07-29 20:40:03 [INFO] this is Doctor's log, only in file.
|
|
62
|
+
#### infile(Doctor Who-20210801165807.log):
|
|
63
|
+
#### p.s. log will name in date + time
|
|
64
|
+
|
|
65
|
+
2021-07-29 20:40:03 [INFO] this is Doctor's log, only in file.
|
|
66
|
+
|
logfly-0.6/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# logfly
|
|
2
|
+
### a simple log tool for python
|
|
3
|
+
|
|
4
|
+
## position
|
|
5
|
+
log will create in ./logs/[date] folder.
|
|
6
|
+
|
|
7
|
+
## How to
|
|
8
|
+
### import
|
|
9
|
+
import logfly
|
|
10
|
+
### use
|
|
11
|
+
logfly.write_log('name', 'where', 'info', 'message', mode='add')
|
|
12
|
+
|
|
13
|
+
## Description
|
|
14
|
+
name: (any str) logfile name, you can use diffrent string to create diffrent logfile.
|
|
15
|
+
where: ('CLI', 'fileCLI', 'file') position where log appear.
|
|
16
|
+
fileCLI means log will appear in command line window and log file.
|
|
17
|
+
CLI means log will only appear in command line window.
|
|
18
|
+
file means log will only appear in logfile.
|
|
19
|
+
info: (any str) custom log level, will upper and wrap with '[]'.
|
|
20
|
+
message: (any str) log message.
|
|
21
|
+
mode: ('add', 'new') default is 'add', means log will add in same day.
|
|
22
|
+
'new' means logfile will create when program every once.
|
|
23
|
+
|
|
24
|
+
## Example:
|
|
25
|
+
|
|
26
|
+
### both file and CLI code
|
|
27
|
+
logfly.write_log('Doctor Who', 'fileCLI', 'info', "this is Doctor's log, in file and CLI.")
|
|
28
|
+
#### in CLI
|
|
29
|
+
2021-07-29 20:39:07 [INFO] this is Doctor's log, in file and CLI.
|
|
30
|
+
#### in file (Doctor Who-2021-07-29.log)
|
|
31
|
+
2021-07-29 20:39:07 [INFO] this is Doctor's log, in file and CLI.
|
|
32
|
+
|
|
33
|
+
### only in CLI code
|
|
34
|
+
logfly.write_log('Doctor Who', 'CLI', 'info', "this is Doctor's log, only in CLI.")
|
|
35
|
+
#### in CLI
|
|
36
|
+
2021-07-29 20:39:07 [INFO] this is Doctor's log, only in CLI.
|
|
37
|
+
#### in file
|
|
38
|
+
None
|
|
39
|
+
|
|
40
|
+
### only in file code
|
|
41
|
+
logfly.write_log('Doctor Who', 'file', 'info', "this is Doctor's log, in file and CLI.")
|
|
42
|
+
#### in CLI
|
|
43
|
+
None
|
|
44
|
+
#### in file (Doctor Who-2021-07-29.log)
|
|
45
|
+
2021-07-29 20:40:03 [INFO] this is Doctor's log, only in file.
|
|
46
|
+
|
|
47
|
+
#### mode arg:
|
|
48
|
+
logfly.write_log('Doctor Who', 'file', 'info', "this is Doctor's log, in file and CLI.", mode='new')
|
|
49
|
+
#### in CLI:
|
|
50
|
+
2021-07-29 20:40:03 [INFO] this is Doctor's log, only in file.
|
|
51
|
+
#### infile(Doctor Who-20210801165807.log):
|
|
52
|
+
#### p.s. log will name in date + time
|
|
53
|
+
|
|
54
|
+
2021-07-29 20:40:03 [INFO] this is Doctor's log, only in file.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import time
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def create_log_folder():
|
|
6
|
+
dirs = '.\\logs\\'
|
|
7
|
+
dirs2 = '.\\logs\\' + get_time('date')
|
|
8
|
+
if not os.path.exists(dirs):
|
|
9
|
+
os.makedirs(dirs)
|
|
10
|
+
else:
|
|
11
|
+
pass
|
|
12
|
+
if not os.path.exists(dirs2):
|
|
13
|
+
os.makedirs(dirs2)
|
|
14
|
+
else:
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def get_time(flag):
|
|
19
|
+
if flag == 'datetime':
|
|
20
|
+
return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
|
|
21
|
+
if flag == 'date':
|
|
22
|
+
return time.strftime("%Y-%m-%d", time.localtime())
|
|
23
|
+
if flag == 'times':
|
|
24
|
+
return time.strftime("%H:%M:%S", time.localtime())
|
|
25
|
+
if flag == 'datetimefile':
|
|
26
|
+
return time.strftime("%Y%m%d%H%M%S", time.localtime())
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def write_log(name, position, level, message, mode='add'):
|
|
30
|
+
global LOGFILE
|
|
31
|
+
logfolder = '.\\logs\\' + get_time('date') + '\\'
|
|
32
|
+
if mode == 'add':
|
|
33
|
+
LOGFILE = logfolder + name + '-' + get_time('date') + '.log'
|
|
34
|
+
elif mode == 'new':
|
|
35
|
+
LOGFILE = logfolder + name + '-' + get_time('datetimefile') + '.log'
|
|
36
|
+
create_log_folder()
|
|
37
|
+
if position == 'CLI':
|
|
38
|
+
print(name + ' ' + get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + '\r\n')
|
|
39
|
+
if position == 'file':
|
|
40
|
+
if mode == 'add':
|
|
41
|
+
File = open(LOGFILE, 'a', newline='')
|
|
42
|
+
File.write(get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + '\r\n')
|
|
43
|
+
File.close()
|
|
44
|
+
elif mode == 'new':
|
|
45
|
+
File = open(LOGFILE, 'w', newline='')
|
|
46
|
+
File.write(get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + '\r\n')
|
|
47
|
+
File.close()
|
|
48
|
+
if position == 'fileCLI':
|
|
49
|
+
print(name + ' ' + get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + '\r\n')
|
|
50
|
+
if mode == 'add':
|
|
51
|
+
File = open(LOGFILE, 'a', newline='')
|
|
52
|
+
File.write(get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + '\r\n')
|
|
53
|
+
File.close()
|
|
54
|
+
elif mode == 'new':
|
|
55
|
+
File = open(LOGFILE, 'w', newline='')
|
|
56
|
+
File.write(get_time('datetime') + ' ' + '[' + str.upper(level) + ']' + ' ' + message + '\r\n')
|
|
57
|
+
File.close()
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
if __name__ == '__main__':
|
|
61
|
+
write_log('Doctor Who', 'CLI', 'info', "this is Doctor's log, only in CLI.")
|
|
62
|
+
write_log('Doctor Who', 'fileCLI', 'info', "this is Doctor's log, in file and CLI.", mode='add')
|
|
63
|
+
write_log('Doctor Who', 'file', 'info', "this is Doctor's log, only in file.")
|
|
64
|
+
write_log('Tardis', 'CLI', 'info', "this is Tardis's log, only in CLI.")
|
|
65
|
+
write_log('Tardis', 'fileCLI', 'info', "this is Tardis's log, in file and CLI.")
|
|
66
|
+
write_log('Tardis', 'file', 'info', "this is Tardis's log, only in file.")
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: logfly
|
|
3
|
+
Version: 0.6
|
|
4
|
+
Summary: a simple log tool for python
|
|
5
|
+
Home-page: https://github.com/TinQlo/logfly
|
|
6
|
+
Author: Yuan Sui
|
|
7
|
+
Author-email: orisui@icloud.com
|
|
8
|
+
License: MIT License
|
|
9
|
+
Platform: UNKNOWN
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# logfly
|
|
13
|
+
### a simple log tool for python
|
|
14
|
+
|
|
15
|
+
## position
|
|
16
|
+
log will create in ./logs/[date] folder.
|
|
17
|
+
|
|
18
|
+
## How to
|
|
19
|
+
### import
|
|
20
|
+
import logfly
|
|
21
|
+
### use
|
|
22
|
+
logfly.write_log('name', 'where', 'info', 'message', mode='add')
|
|
23
|
+
|
|
24
|
+
## Description
|
|
25
|
+
name: (any str) logfile name, you can use diffrent string to create diffrent logfile.
|
|
26
|
+
where: ('CLI', 'fileCLI', 'file') position where log appear.
|
|
27
|
+
fileCLI means log will appear in command line window and log file.
|
|
28
|
+
CLI means log will only appear in command line window.
|
|
29
|
+
file means log will only appear in logfile.
|
|
30
|
+
info: (any str) custom log level, will upper and wrap with '[]'.
|
|
31
|
+
message: (any str) log message.
|
|
32
|
+
mode: ('add', 'new') default is 'add', means log will add in same day.
|
|
33
|
+
'new' means logfile will create when program every once.
|
|
34
|
+
|
|
35
|
+
## Example:
|
|
36
|
+
|
|
37
|
+
### both file and CLI code
|
|
38
|
+
logfly.write_log('Doctor Who', 'fileCLI', 'info', "this is Doctor's log, in file and CLI.")
|
|
39
|
+
#### in CLI
|
|
40
|
+
2021-07-29 20:39:07 [INFO] this is Doctor's log, in file and CLI.
|
|
41
|
+
#### in file (Doctor Who-2021-07-29.log)
|
|
42
|
+
2021-07-29 20:39:07 [INFO] this is Doctor's log, in file and CLI.
|
|
43
|
+
|
|
44
|
+
### only in CLI code
|
|
45
|
+
logfly.write_log('Doctor Who', 'CLI', 'info', "this is Doctor's log, only in CLI.")
|
|
46
|
+
#### in CLI
|
|
47
|
+
2021-07-29 20:39:07 [INFO] this is Doctor's log, only in CLI.
|
|
48
|
+
#### in file
|
|
49
|
+
None
|
|
50
|
+
|
|
51
|
+
### only in file code
|
|
52
|
+
logfly.write_log('Doctor Who', 'file', 'info', "this is Doctor's log, in file and CLI.")
|
|
53
|
+
#### in CLI
|
|
54
|
+
None
|
|
55
|
+
#### in file (Doctor Who-2021-07-29.log)
|
|
56
|
+
2021-07-29 20:40:03 [INFO] this is Doctor's log, only in file.
|
|
57
|
+
|
|
58
|
+
#### mode arg:
|
|
59
|
+
logfly.write_log('Doctor Who', 'file', 'info', "this is Doctor's log, in file and CLI.", mode='new')
|
|
60
|
+
#### in CLI:
|
|
61
|
+
2021-07-29 20:40:03 [INFO] this is Doctor's log, only in file.
|
|
62
|
+
#### infile(Doctor Who-20210801165807.log):
|
|
63
|
+
#### p.s. log will name in date + time
|
|
64
|
+
|
|
65
|
+
2021-07-29 20:40:03 [INFO] this is Doctor's log, only in file.
|
|
66
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
logfly
|
logfly-0.6/setup.cfg
ADDED
logfly-0.6/setup.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from distutils.core import setup
|
|
2
|
+
|
|
3
|
+
with open("README.md", "r") as fh:
|
|
4
|
+
long_description = fh.read()
|
|
5
|
+
|
|
6
|
+
setup(
|
|
7
|
+
name='logfly',
|
|
8
|
+
version='0.6',
|
|
9
|
+
packages=['logfly'],
|
|
10
|
+
url='https://github.com/TinQlo/logfly',
|
|
11
|
+
license='MIT License',
|
|
12
|
+
author='Yuan Sui',
|
|
13
|
+
author_email='orisui@icloud.com',
|
|
14
|
+
description='a simple log tool for python',
|
|
15
|
+
long_description=long_description,
|
|
16
|
+
long_description_content_type="text/markdown",
|
|
17
|
+
)
|