python-printr 4.2__tar.gz → 4.4__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: python-printr
3
- Version: 4.2
3
+ Version: 4.4
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
@@ -6,9 +6,15 @@ from datetime import datetime
6
6
  class Logger:
7
7
  def __init__(self, log_filepath=None, max_lines=100_000, level='info', name=None, log_to_file=True):
8
8
  filename = Path(sys.argv[0]).stem
9
- self.filename = filename
10
9
  if not log_filepath:
11
10
  log_filepath = f'{os.getcwd()}/{filename}.txt'
11
+ 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)
17
+
12
18
  self.log_filepath = log_filepath
13
19
  self.backup_log_filepath = log_filepath.replace('.txt', '_2nd_log.txt')
14
20
  self.max_lines = max_lines
@@ -21,6 +27,7 @@ class Logger:
21
27
 
22
28
  logger = logging.getLogger(__name__)
23
29
  logger.setLevel(self.level)
30
+ logger.propagate = False # Disable duplicate messages with headless Chrome
24
31
 
25
32
  if log_to_file:
26
33
  log_file = logging.FileHandler(log_filepath, encoding='utf-8')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-printr
3
- Version: 4.2
3
+ Version: 4.4
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
@@ -3,7 +3,7 @@ from setuptools import setup
3
3
  setup(
4
4
  name = 'python-printr',
5
5
  packages = ['printr'],
6
- version = '4.2',
6
+ version = '4.4',
7
7
  install_requires=['coloredlogs'],
8
8
  description = 'printr',
9
9
  url = 'https://github.com/xjxckk/python-printr/',
File without changes
File without changes
File without changes