python-printr 4.6__tar.gz → 4.8__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.6/python_printr.egg-info → python-printr-4.8}/PKG-INFO +1 -1
- {python-printr-4.6 → python-printr-4.8}/printr/__init__.py +3 -3
- {python-printr-4.6 → python-printr-4.8/python_printr.egg-info}/PKG-INFO +1 -1
- {python-printr-4.6 → python-printr-4.8}/setup.py +1 -1
- {python-printr-4.6 → python-printr-4.8}/.gitignore +0 -0
- {python-printr-4.6 → python-printr-4.8}/README.md +0 -0
- {python-printr-4.6 → python-printr-4.8}/python_printr.egg-info/SOURCES.txt +0 -0
- {python-printr-4.6 → python-printr-4.8}/python_printr.egg-info/dependency_links.txt +0 -0
- {python-printr-4.6 → python-printr-4.8}/python_printr.egg-info/requires.txt +0 -0
- {python-printr-4.6 → python-printr-4.8}/python_printr.egg-info/top_level.txt +0 -0
- {python-printr-4.6 → python-printr-4.8}/setup.cfg +0 -0
|
@@ -7,7 +7,7 @@ class Logger:
|
|
|
7
7
|
def __init__(self, log_filepath=None, max_lines=10_000, level='info', name=None, log_to_file=True):
|
|
8
8
|
filename = Path(sys.argv[0]).stem
|
|
9
9
|
if not log_filepath:
|
|
10
|
-
log_filepath = f'{os.getcwd()}/{filename}.txt'
|
|
10
|
+
log_filepath = f'{os.getcwd()}/logs/{filename}.txt'
|
|
11
11
|
else:
|
|
12
12
|
path_tree = log_filepath.split('/') # ['logs', 'bot.txt']
|
|
13
13
|
if len(path_tree) > 1:
|
|
@@ -87,8 +87,8 @@ class Logger:
|
|
|
87
87
|
# Rename the current log file to FILE_NAME_2nd_log.txt
|
|
88
88
|
current_datetime = datetime.now()
|
|
89
89
|
formatted_datetime = current_datetime.strftime('%Y-%m-%d %H-%M-%S')
|
|
90
|
-
archive_log_filepath = log_filepath.replace('.txt', f' {formatted_datetime}.txt')
|
|
91
|
-
os.replace(self.log_filepath,
|
|
90
|
+
archive_log_filepath = self.log_filepath.replace('.txt', f' {formatted_datetime}.txt')
|
|
91
|
+
os.replace(self.log_filepath, archive_log_filepath)
|
|
92
92
|
|
|
93
93
|
log_file = logging.FileHandler(self.log_filepath, mode='w', encoding='utf-8')
|
|
94
94
|
log_format = logging.Formatter(fmt=self.indent + '%(levelname)s - %(asctime)s.%(msecs)03d - Line %(lineno)s: %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|