MapleX 3.0.0.dev3__tar.gz → 3.0.0.dev4__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.
- {maplex-3.0.0.dev3/src/MapleX.egg-info → maplex-3.0.0.dev4}/PKG-INFO +10 -2
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/README.md +9 -1
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/pyproject.toml +1 -1
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/readmes/README_Json.md +6 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4/src/MapleX.egg-info}/PKG-INFO +10 -2
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/src/maplex/__init__.py +1 -1
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/src/maplex/mapleLogger.py +44 -23
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/LICENSE +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/MANIFEST.in +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/logErrorOutputSample.png +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/logOutputSample.png +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/readmes/LoggingTips.md +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/readmes/README_ConsoleColors.md +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/readmes/README_Exceptions.md +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/readmes/README_Logger.md +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/readmes/README_MapleTree.md +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/setup.cfg +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/src/MapleX.egg-info/SOURCES.txt +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/src/MapleX.egg-info/dependency_links.txt +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/src/MapleX.egg-info/requires.txt +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/src/MapleX.egg-info/top_level.txt +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/src/maplex/json.py +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/src/maplex/mapleColors.py +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/src/maplex/mapleExceptions.py +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/src/maplex/mapleTreeEditor.py +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/src/maplex/utils.py +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/tests/test_logger_unittest.py +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/tests/test_maplejson_unittest.py +0 -0
- {maplex-3.0.0.dev3 → maplex-3.0.0.dev4}/tests/test_mapletree_unittest.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: MapleX
|
|
3
|
-
Version: 3.0.0.
|
|
3
|
+
Version: 3.0.0.dev4
|
|
4
4
|
Summary: A Python library for simple logging, json file operations, Maple file format operations, and console color utilities.
|
|
5
5
|
Author: RyujiHazama
|
|
6
6
|
Project-URL: PyPI, https://pypi.org/project/MapleX/
|
|
@@ -22,6 +22,11 @@ Dynamic: license-file
|
|
|
22
22
|
|
|
23
23
|
# MapleX
|
|
24
24
|
|
|
25
|
+

|
|
26
|
+

|
|
27
|
+

|
|
28
|
+

|
|
29
|
+
|
|
25
30
|
MapleX is a Python library for simple logging, json file operations, Maple file format operations, and console color utilities.
|
|
26
31
|
|
|
27
32
|
***You can install the package from pip with the following command.***
|
|
@@ -174,9 +179,12 @@ All datas after "\nEOF\n" will be ignored
|
|
|
174
179
|
### From PyPI
|
|
175
180
|
|
|
176
181
|
```bash
|
|
177
|
-
[python[3] -m] pip install MapleX [--break-system-packages]
|
|
182
|
+
[python[3] -m] pip install MapleX [--upgrade] [--break-system-packages]
|
|
178
183
|
```
|
|
179
184
|
|
|
185
|
+
- `--upgrade` option for upgrade from older version.
|
|
186
|
+
- `--break-system-package` option for Python on Linux OS outside the `venv`. ***This might brak the system Python package dependencies.***
|
|
187
|
+
|
|
180
188
|
### Manual Installation
|
|
181
189
|
|
|
182
190
|
1. Download `./dist/maplex-<version>-py3-none-any.whl`
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# MapleX
|
|
2
2
|
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
|
|
3
8
|
MapleX is a Python library for simple logging, json file operations, Maple file format operations, and console color utilities.
|
|
4
9
|
|
|
5
10
|
***You can install the package from pip with the following command.***
|
|
@@ -152,9 +157,12 @@ All datas after "\nEOF\n" will be ignored
|
|
|
152
157
|
### From PyPI
|
|
153
158
|
|
|
154
159
|
```bash
|
|
155
|
-
[python[3] -m] pip install MapleX [--break-system-packages]
|
|
160
|
+
[python[3] -m] pip install MapleX [--upgrade] [--break-system-packages]
|
|
156
161
|
```
|
|
157
162
|
|
|
163
|
+
- `--upgrade` option for upgrade from older version.
|
|
164
|
+
- `--break-system-package` option for Python on Linux OS outside the `venv`. ***This might brak the system Python package dependencies.***
|
|
165
|
+
|
|
158
166
|
### Manual Installation
|
|
159
167
|
|
|
160
168
|
1. Download `./dist/maplex-<version>-py3-none-any.whl`
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "MapleX"
|
|
7
|
-
version = "3.0.0.
|
|
7
|
+
version = "3.0.0.dev4"
|
|
8
8
|
description = """A Python library for simple logging, json file operations, Maple file format operations, and console color utilities."""
|
|
9
9
|
keywords = ["logging", "logger", "json", "file operations", "maple file format", "console colors"]
|
|
10
10
|
readme = "README.md"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: MapleX
|
|
3
|
-
Version: 3.0.0.
|
|
3
|
+
Version: 3.0.0.dev4
|
|
4
4
|
Summary: A Python library for simple logging, json file operations, Maple file format operations, and console color utilities.
|
|
5
5
|
Author: RyujiHazama
|
|
6
6
|
Project-URL: PyPI, https://pypi.org/project/MapleX/
|
|
@@ -22,6 +22,11 @@ Dynamic: license-file
|
|
|
22
22
|
|
|
23
23
|
# MapleX
|
|
24
24
|
|
|
25
|
+

|
|
26
|
+

|
|
27
|
+

|
|
28
|
+

|
|
29
|
+
|
|
25
30
|
MapleX is a Python library for simple logging, json file operations, Maple file format operations, and console color utilities.
|
|
26
31
|
|
|
27
32
|
***You can install the package from pip with the following command.***
|
|
@@ -174,9 +179,12 @@ All datas after "\nEOF\n" will be ignored
|
|
|
174
179
|
### From PyPI
|
|
175
180
|
|
|
176
181
|
```bash
|
|
177
|
-
[python[3] -m] pip install MapleX [--break-system-packages]
|
|
182
|
+
[python[3] -m] pip install MapleX [--upgrade] [--break-system-packages]
|
|
178
183
|
```
|
|
179
184
|
|
|
185
|
+
- `--upgrade` option for upgrade from older version.
|
|
186
|
+
- `--break-system-package` option for Python on Linux OS outside the `venv`. ***This might brak the system Python package dependencies.***
|
|
187
|
+
|
|
180
188
|
### Manual Installation
|
|
181
189
|
|
|
182
190
|
1. Download `./dist/maplex-<version>-py3-none-any.whl`
|
|
@@ -56,27 +56,7 @@ class Logger:
|
|
|
56
56
|
self.__setLogFileSize(maxLogSize)
|
|
57
57
|
self.__setOutputLogLevels(cmdLogLevel, fileLogLevel)
|
|
58
58
|
self.__setFileEncoding(encoding)
|
|
59
|
-
|
|
60
|
-
# Save config file
|
|
61
|
-
|
|
62
|
-
if logConfInstance is not None:
|
|
63
|
-
|
|
64
|
-
try:
|
|
65
|
-
|
|
66
|
-
confJson = logConfInstance.read()
|
|
67
|
-
|
|
68
|
-
except Exception:
|
|
69
|
-
|
|
70
|
-
confJson = {}
|
|
71
|
-
|
|
72
|
-
try:
|
|
73
|
-
|
|
74
|
-
confJson[self.CONFIG_KEY] = self.logConf
|
|
75
|
-
logConfInstance.write(confJson)
|
|
76
|
-
|
|
77
|
-
except Exception as ex:
|
|
78
|
-
|
|
79
|
-
print(f"{self.consoleColors.Red}Warning: Failed to write logger config file: {ex}{self.consoleColors.Reset}")
|
|
59
|
+
self.__saveLogSettings(logConfInstance)
|
|
80
60
|
|
|
81
61
|
except Exception as ex:
|
|
82
62
|
|
|
@@ -311,6 +291,29 @@ class Logger:
|
|
|
311
291
|
|
|
312
292
|
self.encoding = fileEncoding
|
|
313
293
|
|
|
294
|
+
def __saveLogSettings(self, logConfInstance: MapleJson | None) -> None:
|
|
295
|
+
|
|
296
|
+
""" Save current log settings to config file """
|
|
297
|
+
|
|
298
|
+
if logConfInstance is not None:
|
|
299
|
+
|
|
300
|
+
try:
|
|
301
|
+
|
|
302
|
+
confJson = logConfInstance.read()
|
|
303
|
+
|
|
304
|
+
except Exception:
|
|
305
|
+
|
|
306
|
+
confJson = {}
|
|
307
|
+
|
|
308
|
+
try:
|
|
309
|
+
|
|
310
|
+
confJson[self.CONFIG_KEY] = self.logConf
|
|
311
|
+
logConfInstance.write(confJson)
|
|
312
|
+
|
|
313
|
+
except Exception as ex:
|
|
314
|
+
|
|
315
|
+
print(f"{self.consoleColors.Red}Warning: Failed to write logger config file: {ex}{self.consoleColors.Reset}")
|
|
316
|
+
|
|
314
317
|
# Class initialization ends here
|
|
315
318
|
#################################
|
|
316
319
|
|
|
@@ -483,6 +486,12 @@ class Logger:
|
|
|
483
486
|
Output log to log file and console.
|
|
484
487
|
"""
|
|
485
488
|
|
|
489
|
+
# Precheck log level
|
|
490
|
+
|
|
491
|
+
if loglevel < self.consoleLogLevel and loglevel < self.fileLogLevel:
|
|
492
|
+
|
|
493
|
+
return
|
|
494
|
+
|
|
486
495
|
# Console colors
|
|
487
496
|
|
|
488
497
|
Black = self.consoleColors.Black
|
|
@@ -545,8 +554,20 @@ class Logger:
|
|
|
545
554
|
print(f"[{col}{loglevel.name:5}{Reset}]{Green}{self.func}{Reset} {bBlack}{callerFunc}({callerLine}){Reset} {message}")
|
|
546
555
|
|
|
547
556
|
if loglevel >= self.fileLogLevel:
|
|
548
|
-
|
|
549
|
-
|
|
557
|
+
|
|
558
|
+
for i in range(3):
|
|
559
|
+
|
|
560
|
+
try:
|
|
561
|
+
|
|
562
|
+
with open(self.logfile, "a", encoding=self.encoding) as f:
|
|
563
|
+
print(f"({self.pid}) {f"{datetime.now():%F %X.%f}"[:-3]} [{loglevel.name:5}]{self.func} {self.callerName}{callerFunc}({callerLine}) {message}", file=f)
|
|
564
|
+
|
|
565
|
+
break
|
|
566
|
+
|
|
567
|
+
except IOError:
|
|
568
|
+
|
|
569
|
+
if i == 2:
|
|
570
|
+
raise
|
|
550
571
|
|
|
551
572
|
except Exception as ex:
|
|
552
573
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|