python-printr 4.8__tar.gz → 2026.4.15__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
- Name: python-printr
3
- Version: 4.8
2
+ Name: python_printr
3
+ Version: 2026.4.15
4
4
  Summary: printr
5
5
  Home-page: https://github.com/xjxckk/python-printr/
6
6
  Download-URL: https://github.com/xjxckk/python-printr/archive/refs/tags/v0.1.tar.gz
@@ -8,12 +8,18 @@ class Logger:
8
8
  filename = Path(sys.argv[0]).stem
9
9
  if not log_filepath:
10
10
  log_filepath = f'{os.getcwd()}/logs/{filename}.txt'
11
+
12
+ path_tree = log_filepath.split('/') # ['logs', 'bot.txt']
13
+ if len(path_tree) > 1:
14
+ folder_path = '/'.join(path_tree[:-1]) # Remove last item to just keep folder path - e.g. ['logs']
15
+ if not os.path.isdir(folder_path):
16
+ os.mkdir(folder_path)
17
+ if not os.path.isdir(f'{folder_path}/archive'):
18
+ os.mkdir(f'{folder_path}/archive')
19
+ path_tree.insert(-1, 'archive')
20
+ self.archived_log_filepath = '/'.join(path_tree)
11
21
  else:
12
- path_tree = log_filepath.split('/') # ['logs', 'bot.txt']
13
- if len(path_tree) > 1:
14
- folder_path = '/'.join(path_tree[:-1]) # Remove last item to just keep folder path - e.g. ['logs']
15
- if not os.path.isdir(folder_path):
16
- os.mkdir(folder_path)
22
+ self.archived_log_filepath = log_filepath
17
23
 
18
24
  self.log_filepath = log_filepath
19
25
  self.max_lines = max_lines
@@ -87,7 +93,7 @@ class Logger:
87
93
  # Rename the current log file to FILE_NAME_2nd_log.txt
88
94
  current_datetime = datetime.now()
89
95
  formatted_datetime = current_datetime.strftime('%Y-%m-%d %H-%M-%S')
90
- archive_log_filepath = self.log_filepath.replace('.txt', f' {formatted_datetime}.txt')
96
+ archive_log_filepath = self.archived_log_filepath.replace('.txt', f' {formatted_datetime}.txt')
91
97
  os.replace(self.log_filepath, archive_log_filepath)
92
98
 
93
99
  log_file = logging.FileHandler(self.log_filepath, mode='w', encoding='utf-8')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-printr
3
- Version: 4.8
3
+ Version: 2026.4.15
4
4
  Summary: printr
5
5
  Home-page: https://github.com/xjxckk/python-printr/
6
6
  Download-URL: https://github.com/xjxckk/python-printr/archive/refs/tags/v0.1.tar.gz
@@ -1,4 +1,3 @@
1
- .gitignore
2
1
  README.md
3
2
  setup.cfg
4
3
  setup.py
@@ -1,9 +1,9 @@
1
1
  from setuptools import setup
2
2
 
3
3
  setup(
4
- name = 'python-printr',
4
+ name = 'python_printr',
5
5
  packages = ['printr'],
6
- version = '4.8',
6
+ version = '2026.4.15',
7
7
  install_requires=['coloredlogs'],
8
8
  description = 'printr',
9
9
  url = 'https://github.com/xjxckk/python-printr/',
@@ -1,5 +0,0 @@
1
- /__pycache__/
2
- /printr/__pycache__/
3
- /dist/
4
- /*.egg-info/
5
- test*
File without changes
File without changes