LogFly 2.0__tar.gz → 2.1__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.0
3
+ Version: 2.1
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.0
18
+ # logfly 2.1
19
19
  ### a simple log tool by python.
20
20
 
21
21
  ## position
@@ -25,8 +25,8 @@ if use hidden, log will also appear in user/.1o9f1y folder.
25
25
  ## How to
26
26
  ### import
27
27
  import logfly
28
- ### write log
29
- logfly.write_log('name', 'where', 'info', 'message', mode='add', folder_name='logflys', hidden='no', color='yes', str_message='yes')
28
+ ### write_log
29
+ logfly.write_log('name', 'where', 'info', 'message', mode='add', folder_name='default-log', 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.
@@ -38,12 +38,12 @@ if use hidden, log will also appear in user/.1o9f1y folder.
38
38
  message: (any str) log message.
39
39
  mode: ('add', 'new') default is 'add', means log will add in same day.
40
40
  'new' means logfile will create when program every once.
41
- folder_name: (any str) custom logfly folder name, default is 'logflys'.
41
+ folder_name: (any str) custom logfly folder name, default is 'default-log'.
42
42
  hidden: ('yes', 'no') default is 'no', means logfile will save a copy 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
46
+ ### create_or_check_file
47
47
  create_or_check_file(pathorfile, name, warning='yes'):
48
48
  create or check file.
49
49
  pathorfile: ('file', 'path') choose to create file or path.
@@ -1,4 +1,4 @@
1
- # logfly 2.0
1
+ # logfly 2.1
2
2
  ### a simple log tool by python.
3
3
 
4
4
  ## position
@@ -8,8 +8,8 @@ if use hidden, log will also appear in user/.1o9f1y folder.
8
8
  ## How to
9
9
  ### import
10
10
  import logfly
11
- ### write log
12
- logfly.write_log('name', 'where', 'info', 'message', mode='add', folder_name='logflys', hidden='no', color='yes', str_message='yes')
11
+ ### write_log
12
+ logfly.write_log('name', 'where', 'info', 'message', mode='add', folder_name='default-log', 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.
@@ -21,12 +21,12 @@ if use hidden, log will also appear in user/.1o9f1y folder.
21
21
  message: (any str) log message.
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
- folder_name: (any str) custom logfly folder name, default is 'logflys'.
24
+ folder_name: (any str) custom logfly folder name, default is 'default-log'.
25
25
  hidden: ('yes', 'no') default is 'no', means logfile will save a copy 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
29
+ ### create_or_check_file
30
30
  create_or_check_file(pathorfile, name, warning='yes'):
31
31
  create or check file.
32
32
  pathorfile: ('file', 'path') choose to create file or path.
@@ -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.0",
8
+ version="2.1",
9
9
  author="Yuan Sui",
10
10
  author_email="orisui@icloud.com",
11
11
  description="A simple log tool by python",
@@ -1,6 +1,6 @@
1
1
  #####################
2
2
  # Author: Yuki Sui
3
- # Date: 2022-3-4
3
+ # Date: 2022-3-11
4
4
  #####################
5
5
 
6
6
  import time
@@ -10,7 +10,7 @@ from pathlib import Path
10
10
  from colorama import init
11
11
 
12
12
  init(autoreset=True)
13
- __version__ = '2.0'
13
+ __version__ = '2.1'
14
14
 
15
15
 
16
16
  def create_or_check_file(pathorfile, name, warning='yes'):
@@ -38,7 +38,7 @@ def create_or_check_file(pathorfile, name, warning='yes'):
38
38
  error(e, linenum)
39
39
 
40
40
 
41
- def create_log_folder(folder_name, hidden):
41
+ def create_log_folder(folder_name, hidden='no'):
42
42
  dirs = '.\\logs\\'
43
43
  dirs2 = '.\\logs\\' + folder_name + '\\' + get_time('date') + '\\'
44
44
  dirs3 = str(Path.home()) + '\\.1o9f1y\\' + folder_name + '\\' + get_time('date') + '\\'
@@ -98,9 +98,10 @@ def time_transfer(time_stamp, flag='timestamp2datetime'):
98
98
 
99
99
  # noinspection PyTypeChecker
100
100
  def write_log(name, position, level, message, mode='add',
101
- folder_name='logflys', hidden='no', color='yes', str_message='yes'):
101
+ folder_name='default-log', hidden='no', color='yes', str_message='yes'):
102
102
  global LOGFILE, LOGFILE2, logfolder, logfolder_hidden, LOGFILE_hidden
103
103
  try:
104
+ create_log_folder(folder_name)
104
105
  if str_message == 'yes':
105
106
  message = str(message)
106
107
  elif str_message == 'no':
@@ -235,3 +236,7 @@ def error(exp,linenum, mode='logfly'):
235
236
  class ParameterERROR(Exception):
236
237
  def __init__(self, message):
237
238
  self.message = message
239
+
240
+
241
+ if __name__ == '__main__':
242
+ write_log('logfly-log', 'fileCLI', 'error', 'test', hidden='yes')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: logfly
3
- Version: 2.0
3
+ Version: 2.1
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.0
18
+ # logfly 2.1
19
19
  ### a simple log tool by python.
20
20
 
21
21
  ## position
@@ -25,8 +25,8 @@ if use hidden, log will also appear in user/.1o9f1y folder.
25
25
  ## How to
26
26
  ### import
27
27
  import logfly
28
- ### write log
29
- logfly.write_log('name', 'where', 'info', 'message', mode='add', folder_name='logflys', hidden='no', color='yes', str_message='yes')
28
+ ### write_log
29
+ logfly.write_log('name', 'where', 'info', 'message', mode='add', folder_name='default-log', 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.
@@ -38,12 +38,12 @@ if use hidden, log will also appear in user/.1o9f1y folder.
38
38
  message: (any str) log message.
39
39
  mode: ('add', 'new') default is 'add', means log will add in same day.
40
40
  'new' means logfile will create when program every once.
41
- folder_name: (any str) custom logfly folder name, default is 'logflys'.
41
+ folder_name: (any str) custom logfly folder name, default is 'default-log'.
42
42
  hidden: ('yes', 'no') default is 'no', means logfile will save a copy 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
46
+ ### create_or_check_file
47
47
  create_or_check_file(pathorfile, name, warning='yes'):
48
48
  create or check file.
49
49
  pathorfile: ('file', 'path') choose to create file or path.
File without changes
File without changes
File without changes