MapleX 3.2.0.dev3__tar.gz → 3.2.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.
Files changed (39) hide show
  1. {maplex-3.2.0.dev3/src/MapleX.egg-info → maplex-3.2.0.dev4}/PKG-INFO +1 -1
  2. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/pyproject.toml +1 -1
  3. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4/src/MapleX.egg-info}/PKG-INFO +1 -1
  4. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/maplex/__init__.py +1 -1
  5. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/maplex/library/logger/config.py +24 -2
  6. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/maplex/library/logger/consts/__init__.py +2 -0
  7. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/maplex/library/logger/consts/config_keys.py +1 -0
  8. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/maplex/library/logger/consts/defaults.py +1 -0
  9. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/maplex/mapleLogger.py +2 -2
  10. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/LICENSE +0 -0
  11. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/MANIFEST.in +0 -0
  12. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/README.md +0 -0
  13. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/logErrorOutputSample.png +0 -0
  14. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/logOutputSample.png +0 -0
  15. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/readmes/LoggingBestPractice.md +0 -0
  16. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/readmes/README_ConsoleColors.md +0 -0
  17. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/readmes/README_Exceptions.md +0 -0
  18. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/readmes/README_Json.md +0 -0
  19. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/readmes/README_Logger.md +0 -0
  20. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/readmes/README_MapleTree.md +0 -0
  21. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/setup.cfg +0 -0
  22. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/MapleX.egg-info/SOURCES.txt +0 -0
  23. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/MapleX.egg-info/dependency_links.txt +0 -0
  24. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/MapleX.egg-info/requires.txt +0 -0
  25. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/MapleX.egg-info/top_level.txt +0 -0
  26. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/maplex/jsonHandler.py +0 -0
  27. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/maplex/library/logger/__init__.py +0 -0
  28. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/maplex/library/logger/consts/dict_keys.py +0 -0
  29. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/maplex/library/logger/file_handler.py +0 -0
  30. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/maplex/library/logger/formatter.py +0 -0
  31. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/maplex/library/logger/log_levels.py +0 -0
  32. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/maplex/library/logger/utilities.py +0 -0
  33. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/maplex/mapleColors.py +0 -0
  34. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/maplex/mapleExceptions.py +0 -0
  35. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/maplex/mapleTreeEditor.py +0 -0
  36. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/src/maplex/utils.py +0 -0
  37. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/tests/test_logger_unittest.py +0 -0
  38. {maplex-3.2.0.dev3 → maplex-3.2.0.dev4}/tests/test_maplejson_unittest.py +0 -0
  39. {maplex-3.2.0.dev3 → maplex-3.2.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.2.0.dev3
3
+ Version: 3.2.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: Ryuji Hazama
6
6
  Project-URL: PyPI, https://pypi.org/project/MapleX/
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "MapleX"
7
- version = "3.2.0.dev3"
7
+ version = "3.2.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.2.0.dev3
3
+ Version: 3.2.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: Ryuji Hazama
6
6
  Project-URL: PyPI, https://pypi.org/project/MapleX/
@@ -52,7 +52,7 @@ __all__ = [
52
52
  'winUnHide'
53
53
  ]
54
54
 
55
- __version__ = "3.2.0.dev3"
55
+ __version__ = "3.2.0.dev4"
56
56
  __author__ = "Ryuji Hazama"
57
57
  __license__ = "MIT"
58
58
 
@@ -30,6 +30,7 @@ class Formats(BaseModel):
30
30
 
31
31
  consoleFormat: str | None = None
32
32
  fileFormat: str | None = None
33
+ separator: str | None = None
33
34
  timestamp: TimeStamp | None = None
34
35
 
35
36
  class LoggerConfig(BaseModel):
@@ -70,7 +71,7 @@ class LoggerConfig(BaseModel):
70
71
  self.setOutputLogLevels(config.get(CONSOLE_LOG_LEVEL, None), config.get(FILE_LOG_LEVEL, None))
71
72
  self.setFileEncoding(config.get(FILE_ENCODING, None))
72
73
  self.setTimestampFormat(config.get(PARAM_TIMESTAMP, None))
73
- self.setOutputFormat(config.get(CONSOLE_LOG_FORMAT, None), config.get(FILE_LOG_FORMAT, None))
74
+ self.setOutputFormat(config.get(CONSOLE_LOG_FORMAT, None), config.get(FILE_LOG_FORMAT, None), config.get(SEPARATOR, None))
74
75
  self.saveLogSettings(self.logConfInstance)
75
76
 
76
77
  except Exception as ex:
@@ -361,7 +362,7 @@ class LoggerConfig(BaseModel):
361
362
  self.formats.timestamp.timestampFormat = configTimestampFormat
362
363
  self.formats.timestamp.digits = configTimestampDigits
363
364
 
364
- def setOutputFormat(self, consoleFormat: str, fileFormat: str) -> None:
365
+ def setOutputFormat(self, consoleFormat: str, fileFormat: str, separator: str | None = None) -> None:
365
366
 
366
367
  """Set output format for console and file logs. Default is "[{level}]{func} {callerFunc}{callerLine}" for console and "({pid}) {timestamp} [{level}]{func} {callerName}{callerFunc}({callerLine})" for file. You can set this in config file with keys "ConsoleLogFormat" and "FileLogFormat"."""
367
368
 
@@ -369,6 +370,8 @@ class LoggerConfig(BaseModel):
369
370
 
370
371
  self.formats = Formats()
371
372
 
373
+ # Console format
374
+
372
375
  if consoleFormat is not None:
373
376
 
374
377
  self.formats.consoleFormat = consoleFormat
@@ -384,6 +387,8 @@ class LoggerConfig(BaseModel):
384
387
  formatConf[CONSOLE_LOG_FORMAT] = CONSOLE_FORMAT
385
388
  self.logConf[FORMATS] = formatConf
386
389
 
390
+ # File format
391
+
387
392
  if fileFormat is not None:
388
393
 
389
394
  self.formats.fileFormat = fileFormat
@@ -399,6 +404,23 @@ class LoggerConfig(BaseModel):
399
404
  formatConf[FILE_LOG_FORMAT] = FILE_FORMAT
400
405
  self.logConf[FORMATS] = formatConf
401
406
 
407
+ # Message separator
408
+
409
+ if separator is not None:
410
+
411
+ self.formats.separator = separator
412
+
413
+ else:
414
+
415
+ self.formats.separator = self.logConf.get(FORMATS, {}).get(SEPARATOR, None)
416
+
417
+ if self.formats.separator is None:
418
+
419
+ self.formats.separator = DEFAULT_SEPARATOR
420
+ formatConf = self.logConf.get(FORMATS, {})
421
+ formatConf[SEPARATOR] = DEFAULT_SEPARATOR
422
+ self.logConf[FORMATS] = formatConf
423
+
402
424
  def saveLogSettings(self, logConfInstance: MapleJson | None) -> None:
403
425
 
404
426
  """ Save current log settings to config file """
@@ -19,6 +19,7 @@ __all__ = [
19
19
  "ALIGN_WIDTH",
20
20
  "CONSOLE_LOG_FORMAT",
21
21
  "FILE_LOG_FORMAT",
22
+ "SEPARATOR",
22
23
  "NAME_SPACES",
23
24
  "NAME_SPACE",
24
25
  # Dictionary keys for internal use
@@ -36,6 +37,7 @@ __all__ = [
36
37
  # Default values
37
38
  "FILE_FORMAT",
38
39
  "CONSOLE_FORMAT",
40
+ "DEFAULT_SEPARATOR",
39
41
  "TIMESTAMP_FORMAT",
40
42
  "MILLISECOND_DIGITS",
41
43
  "FILE_MODE_OVERWRITE",
@@ -11,6 +11,7 @@ FILE_ENCODING = "FileEncoding"
11
11
  FORMATS = "Formats"
12
12
  CONSOLE_LOG_FORMAT = "ConsoleLogFormat"
13
13
  FILE_LOG_FORMAT = "FileLogFormat"
14
+ SEPARATOR = "Separator"
14
15
  TIMESTAMP = "Timestamp"
15
16
  FORMAT = "Format"
16
17
  DIGITS = "Digits"
@@ -1,5 +1,6 @@
1
1
  FILE_FORMAT = '({pid}) {timestamp} [{level}]{func} {callerName}{callerFunc}({callerLine})'
2
2
  CONSOLE_FORMAT = '[{level}]{func} {callerFunc}{callerLine}'
3
+ DEFAULT_SEPARATOR = ': '
3
4
  TIMESTAMP_FORMAT = "%F %X.%f"
4
5
  MILLISECOND_DIGITS = None
5
6
  FILE_MODE_OVERWRITE = 'overwrite'
@@ -166,7 +166,7 @@ class Logger:
166
166
 
167
167
  if loglevel >= self.config.consoleLogLevel:
168
168
  consolePrefix = self.formatter.format_console(loglevel, callerDepth)
169
- print(f"{consolePrefix}: {message}")
169
+ print(f"{consolePrefix}{self.config.formats.separator}{message}")
170
170
 
171
171
  if loglevel >= self.config.fileLogLevel:
172
172
 
@@ -177,7 +177,7 @@ class Logger:
177
177
  try:
178
178
 
179
179
  with open(self.config.logfile, "a", encoding=self.config.encoding) as f:
180
- print(f"{prefixString}: {message}", file=f)
180
+ print(f"{prefixString}{self.config.formats.separator}{message}", file=f)
181
181
 
182
182
  break
183
183
 
File without changes
File without changes
File without changes
File without changes