python-printr 4.7__tar.gz → 4.9__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.7/python_printr.egg-info → python-printr-4.9}/PKG-INFO +1 -1
- {python-printr-4.7 → python-printr-4.9}/printr/__init__.py +7 -7
- {python-printr-4.7 → python-printr-4.9/python_printr.egg-info}/PKG-INFO +1 -1
- {python-printr-4.7 → python-printr-4.9}/setup.py +1 -1
- {python-printr-4.7 → python-printr-4.9}/.gitignore +0 -0
- {python-printr-4.7 → python-printr-4.9}/README.md +0 -0
- {python-printr-4.7 → python-printr-4.9}/python_printr.egg-info/SOURCES.txt +0 -0
- {python-printr-4.7 → python-printr-4.9}/python_printr.egg-info/dependency_links.txt +0 -0
- {python-printr-4.7 → python-printr-4.9}/python_printr.egg-info/requires.txt +0 -0
- {python-printr-4.7 → python-printr-4.9}/python_printr.egg-info/top_level.txt +0 -0
- {python-printr-4.7 → python-printr-4.9}/setup.cfg +0 -0
|
@@ -7,13 +7,13 @@ 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'
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
17
|
|
|
18
18
|
self.log_filepath = log_filepath
|
|
19
19
|
self.max_lines = max_lines
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|