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.
- {python-printr-4.8 → python_printr-2026.4.15}/PKG-INFO +2 -2
- {python-printr-4.8 → python_printr-2026.4.15}/printr/__init__.py +12 -6
- {python-printr-4.8 → python_printr-2026.4.15}/python_printr.egg-info/PKG-INFO +1 -1
- {python-printr-4.8 → python_printr-2026.4.15}/python_printr.egg-info/SOURCES.txt +0 -1
- {python-printr-4.8 → python_printr-2026.4.15}/setup.py +2 -2
- python-printr-4.8/.gitignore +0 -5
- {python-printr-4.8 → python_printr-2026.4.15}/README.md +0 -0
- {python-printr-4.8 → python_printr-2026.4.15}/python_printr.egg-info/dependency_links.txt +0 -0
- {python-printr-4.8 → python_printr-2026.4.15}/python_printr.egg-info/requires.txt +0 -0
- {python-printr-4.8 → python_printr-2026.4.15}/python_printr.egg-info/top_level.txt +0 -0
- {python-printr-4.8 → python_printr-2026.4.15}/setup.cfg +0 -0
|
@@ -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
|
-
|
|
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.
|
|
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,9 +1,9 @@
|
|
|
1
1
|
from setuptools import setup
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
|
-
name = '
|
|
4
|
+
name = 'python_printr',
|
|
5
5
|
packages = ['printr'],
|
|
6
|
-
version = '4.
|
|
6
|
+
version = '2026.4.15',
|
|
7
7
|
install_requires=['coloredlogs'],
|
|
8
8
|
description = 'printr',
|
|
9
9
|
url = 'https://github.com/xjxckk/python-printr/',
|
python-printr-4.8/.gitignore
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|