python-printr 3.6__tar.gz → 3.7__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-3.6/python_printr.egg-info → python-printr-3.7}/PKG-INFO +1 -1
- {python-printr-3.6 → python-printr-3.7}/printr/__init__.py +4 -2
- {python-printr-3.6 → python-printr-3.7/python_printr.egg-info}/PKG-INFO +1 -1
- {python-printr-3.6 → python-printr-3.7}/setup.py +1 -1
- {python-printr-3.6 → python-printr-3.7}/.gitignore +0 -0
- {python-printr-3.6 → python-printr-3.7}/README.md +0 -0
- {python-printr-3.6 → python-printr-3.7}/python_printr.egg-info/SOURCES.txt +0 -0
- {python-printr-3.6 → python-printr-3.7}/python_printr.egg-info/dependency_links.txt +0 -0
- {python-printr-3.6 → python-printr-3.7}/python_printr.egg-info/requires.txt +0 -0
- {python-printr-3.6 → python-printr-3.7}/python_printr.egg-info/top_level.txt +0 -0
- {python-printr-3.6 → python-printr-3.7}/setup.cfg +0 -0
|
@@ -9,6 +9,7 @@ class logger:
|
|
|
9
9
|
if not log_filepath:
|
|
10
10
|
log_filepath = f'{os.getcwd()}/{filename}.txt'
|
|
11
11
|
self.log_filepath = log_filepath
|
|
12
|
+
backup_log_filepath = log_filepath.replace('.txt', '_2.txt')
|
|
12
13
|
self.max_lines = max_lines
|
|
13
14
|
self.log_to_file = log_to_file
|
|
14
15
|
|
|
@@ -71,6 +72,7 @@ class logger:
|
|
|
71
72
|
if number_of_lines > self.max_lines:
|
|
72
73
|
self.logger.info('Resetting log file')
|
|
73
74
|
self.log_file.close()
|
|
75
|
+
os.rename(self.log_filepath, backup_log_filepath)
|
|
74
76
|
log_file = logging.FileHandler(self.log_filepath, mode='w', encoding='utf-8')
|
|
75
77
|
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')
|
|
76
78
|
log_file.setFormatter(log_format)
|
|
@@ -92,10 +94,10 @@ class logger:
|
|
|
92
94
|
def warning(self, *items):
|
|
93
95
|
self.log(*items, level='warning')
|
|
94
96
|
|
|
95
|
-
def current_time(self, *items, level='info'):
|
|
97
|
+
def current_time(self, *items, level='info', beautify=True):
|
|
96
98
|
current_time = datetime.now()
|
|
97
99
|
current_time = current_time.strftime('%H:%M:%S:%f') + ':'
|
|
98
|
-
self.log(current_time, *items, level=level)
|
|
100
|
+
self.log(current_time, *items, level=level, beautify=beautify)
|
|
99
101
|
|
|
100
102
|
def set_indent(self, indent=' - '):
|
|
101
103
|
if self.log_to_file:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|