inspy-logger 3.0.2.dev1__tar.gz → 3.1.0__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 (48) hide show
  1. {inspy_logger-3.0.2.dev1 → inspy_logger-3.1.0}/LICENSE.md +20 -20
  2. {inspy_logger-3.0.2.dev1 → inspy_logger-3.1.0}/PKG-INFO +12 -27
  3. {inspy_logger-3.0.2.dev1 → inspy_logger-3.1.0}/README.md +54 -54
  4. {inspy_logger-3.0.2.dev1 → inspy_logger-3.1.0}/inspy_logger/Scripts/main.py +27 -32
  5. {inspy_logger-3.0.2.dev1 → inspy_logger-3.1.0}/inspy_logger/__about__.py +24 -21
  6. inspy_logger-3.1.0/inspy_logger/__init__.py +138 -0
  7. inspy_logger-3.1.0/inspy_logger/common/__init__.py +120 -0
  8. inspy_logger-3.1.0/inspy_logger/common/meta.py +45 -0
  9. inspy_logger-3.1.0/inspy_logger/config/__init__.py +18 -0
  10. inspy_logger-3.1.0/inspy_logger/config/dirs.py +133 -0
  11. inspy_logger-3.1.0/inspy_logger/config/levels.py +29 -0
  12. inspy_logger-3.1.0/inspy_logger/constants.py +48 -0
  13. inspy_logger-3.1.0/inspy_logger/engine/__init__.py +894 -0
  14. inspy_logger-3.1.0/inspy_logger/engine/errors.py +49 -0
  15. inspy_logger-3.1.0/inspy_logger/engine/handlers.py +50 -0
  16. {inspy_logger-3.0.2.dev1 → inspy_logger-3.1.0}/inspy_logger/errors/__init__.py +121 -121
  17. inspy_logger-3.1.0/inspy_logger/helpers/__init__.py +648 -0
  18. {inspy_logger-3.0.2.dev1 → inspy_logger-3.1.0}/inspy_logger/helpers/base_classes.py +27 -18
  19. inspy_logger-3.1.0/inspy_logger/helpers/command_line/__init__.py +28 -0
  20. {inspy_logger-3.0.2.dev1 → inspy_logger-3.1.0}/inspy_logger/helpers/debug/environment.py +5 -0
  21. inspy_logger-3.1.0/inspy_logger/helpers/decorators.py +303 -0
  22. inspy_logger-3.1.0/inspy_logger/helpers/descriptors.py +270 -0
  23. {inspy_logger-3.0.2.dev1 → inspy_logger-3.1.0}/inspy_logger/helpers/network.py +388 -388
  24. {inspy_logger-3.0.2.dev1 → inspy_logger-3.1.0}/inspy_logger/helpers/units.py +1 -1
  25. {inspy_logger-3.0.2.dev1 → inspy_logger-3.1.0}/inspy_logger/manifest.py +40 -40
  26. inspy_logger-3.1.0/inspy_logger/models/__init__.py +0 -0
  27. inspy_logger-3.1.0/inspy_logger/models/announcement/__init__.py +178 -0
  28. inspy_logger-3.1.0/inspy_logger/models/announcement/placeholder/__init__.py +412 -0
  29. inspy_logger-3.1.0/inspy_logger/models/announcement/placeholder/helpers.py +46 -0
  30. inspy_logger-3.1.0/inspy_logger/system/__init__.py +47 -0
  31. inspy_logger-3.1.0/inspy_logger/system/linux.py +36 -0
  32. inspy_logger-3.1.0/inspy_logger/system/mac_os.py +23 -0
  33. inspy_logger-3.1.0/inspy_logger/system/win32.py +50 -0
  34. inspy_logger-3.1.0/inspy_logger/tool/__init__.py +4 -0
  35. inspy_logger-3.1.0/inspy_logger/tool/config/__init__.py +0 -0
  36. inspy_logger-3.1.0/inspy_logger/tool/config/arguments/__init__.py +56 -0
  37. inspy_logger-3.1.0/inspy_logger/types.py +169 -0
  38. inspy_logger-3.1.0/inspy_logger/version/VERSION.txt +1 -0
  39. inspy_logger-3.1.0/inspy_logger/version/__init__.py +491 -0
  40. inspy_logger-3.1.0/pyproject.toml +42 -0
  41. inspy_logger-3.0.2.dev1/inspy_logger/__init__.py +0 -343
  42. inspy_logger-3.0.2.dev1/inspy_logger/helpers/__init__.py +0 -189
  43. inspy_logger-3.0.2.dev1/inspy_logger/version.py +0 -240
  44. inspy_logger-3.0.2.dev1/pyproject.toml +0 -71
  45. {inspy_logger-3.0.2.dev1 → inspy_logger-3.1.0}/inspy_logger/helpers/debug/__init__.py +0 -0
  46. {inspy_logger-3.0.2.dev1 → inspy_logger-3.1.0}/inspy_logger/helpers/debug/system/__init__.py +0 -0
  47. {inspy_logger-3.0.2.dev1 → inspy_logger-3.1.0}/inspy_logger/helpers/debug/system/processor/__init__.py +0 -0
  48. {inspy_logger-3.0.2.dev1 → inspy_logger-3.1.0}/inspy_logger/helpers/debug/system/winx/__init__.py +0 -0
@@ -1,20 +1,20 @@
1
- ### Do What the Fuck You Want To - Public License (v3.0 3, Sept. 2020)
2
- ----
3
- ----
4
-
5
- Copyright (C) 2020 Taylor-Jayde Blackstone <t.blackstone@inspyre.tech>
6
-
7
- ----
8
-
9
- Everyone is permitted to copy and distribute verbatim or modified
10
- copies of this license document, and changing it is allowed as long
11
- as the name is changed. That's my name, you can't have it.
12
-
13
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
14
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
15
-
16
- - You just **DO WHAT THE FUCK YOU WANT TO**.
17
- - You **don't** blame me for **shit**. _I don't care_ how much smoke your hard-drive spewed out.
18
- - If someone else did what the fuck they wanted to and you're _**triggered**_ I'm **not** responsible.
19
-
20
- Contact <dev.null@inspyre.tech> with any complaints.
1
+ ### Do What the Fuck You Want To - Public License (v3.0 3, Sept. 2020)
2
+ ----
3
+ ----
4
+
5
+ Copyright (C) 2020 Taylor-Jayde Blackstone <t.blackstone@inspyre.tech>
6
+
7
+ ----
8
+
9
+ Everyone is permitted to copy and distribute verbatim or modified
10
+ copies of this license document, and changing it is allowed as long
11
+ as the name is changed. That's my name, you can't have it.
12
+
13
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
14
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
15
+
16
+ - You just **DO WHAT THE FUCK YOU WANT TO**.
17
+ - You **don't** blame me for **shit**. _I don't care_ how much smoke your hard-drive spewed out.
18
+ - If someone else did what the fuck they wanted to and you're _**triggered**_ I'm **not** responsible.
19
+
20
+ Contact <dev.null@inspyre.tech> with any complaints.
@@ -1,41 +1,26 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: inspy-logger
3
- Version: 3.0.2.dev1
3
+ Version: 3.1.0
4
4
  Summary: Colorable, scalable logger for CLI
5
- Home-page: https://github.com/Inspyre-Softworks/inSPy-Logger
6
5
  License: MIT
7
- Keywords: cli,color,logging,log,terminal,console,colorama,colorlog,rich
8
- Author: Taylor-Jayde Blackstone
6
+ Author: Taylor B.
9
7
  Author-email: tayjaybabee@gmail.com
10
- Requires-Python: >=3.9,<4.0
11
- Classifier: Development Status :: 5 - Production/Stable
12
- Classifier: Intended Audience :: Developers
8
+ Requires-Python: >=3.10,<4.0
13
9
  Classifier: License :: OSI Approved :: MIT License
14
- Classifier: Natural Language :: English
15
- Classifier: Operating System :: OS Independent
16
10
  Classifier: Programming Language :: Python :: 3
17
- Classifier: Programming Language :: Python :: 3.9
18
11
  Classifier: Programming Language :: Python :: 3.10
19
12
  Classifier: Programming Language :: Python :: 3.11
20
13
  Classifier: Programming Language :: Python :: 3.12
21
- Classifier: Programming Language :: Python :: 3 :: Only
22
- Classifier: Programming Language :: Python :: 3.7
23
- Classifier: Programming Language :: Python :: 3.8
24
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
- Classifier: Topic :: System :: Logging
26
- Classifier: Topic :: Utilities
27
14
  Requires-Dist: appdirs (>=1.4.4,<2.0.0)
28
- Requires-Dist: colorama (>=0.4.6,<0.5.0)
29
- Requires-Dist: colorlog (>=6.7,<7.0)
30
- Requires-Dist: humanize (>=4.4.0,<5.0.0)
31
- Requires-Dist: luddite (>=1.0.1,<2.0.0)
32
- Requires-Dist: packaging (>=21.0,<22.0)
33
- Requires-Dist: python-box (>=6.1.0,<7.0.0)
34
- Requires-Dist: requests (>=2.28.1,<3.0.0)
35
- Requires-Dist: rich (>=13.5.2,<14.0.0)
36
- Requires-Dist: setuptools-autover (>=1.0.2,<2.0.0)
37
- Project-URL: Documentation, https://inspy-logger.readthedocs.io/en/latest/
38
- Project-URL: Repository, https://github.com/Inspyre-Softworks/inSPy-Logger
15
+ Requires-Dist: packaging (>=24.1,<25.0)
16
+ Requires-Dist: platformdirs (>=4.2.2,<5.0.0)
17
+ Requires-Dist: psutil (>=6.0.0,<7.0.0)
18
+ Requires-Dist: pypattyrn (>=1.2,<2.0)
19
+ Requires-Dist: pyperclip (>=1.8.2,<2.0.0)
20
+ Requires-Dist: python-box (>=7.2.0,<8.0.0)
21
+ Requires-Dist: requests (>=2.32.3,<3.0.0)
22
+ Requires-Dist: rich (>=13.7.1,<14.0.0)
23
+ Requires-Dist: urllib3 (>=2.2.2,<3.0.0)
39
24
  Description-Content-Type: text/markdown
40
25
 
41
26
  # inSPy-Logger
@@ -1,54 +1,54 @@
1
- # inSPy-Logger
2
- ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/Inspyre-Softworks/inSPy-Logger/CI?label=CI&logo=github&logoColor=9cf&style=for-the-badge)
3
- ![Codacy grade](https://img.shields.io/codacy/grade/7171eec682c549a88dee0da9cc9b92b3?logo=codacy&logoColor=9cf&style=for-the-badge)
4
- ![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/Inspyre-Softworks/inSPy-Logger?color=9cf&include_prereleases&label=Pre-Release&logo=pypi&logoColor=9cf&style=for-the-badge)
5
- ![PyPI](https://img.shields.io/pypi/v/inspy-logger?color=9cf&label=Latest&logo=pypi&logoColor=9cf&style=for-the-badge)
6
- ![GitHub issues](https://img.shields.io/github/issues/Inspyre-Softworks/inSPy-Logger?color=9cf&logo=github&logoColor=9cf&style=for-the-badge)
7
- ![PyPI - Format](https://img.shields.io/pypi/format/inSPy-Logger?logo=PyPi&style=for-the-badge)
8
-
9
- ## Installation
10
-
11
- ### Prerequisites:
12
-
13
- **Platform/Env**:
14
- * **Python**: ^3.6.3
15
- * **PIP**: (_If you want to install via PIP, that is_)
16
-
17
- **inSPy-Logger Runtime Dependencies**:
18
- I am providing this list of dependencies for transparency and for instances where one would not be able to install inSPy-Logger via PyPi's package manager. It is **highly** recommended you use `python3 -m pip install inspy_logger==<ver>` to install inSPy-Logger 2.0+
19
-
20
- * [colorlog](https://pypi.org/project/colorlog) (^4.2.1)
21
- * [setuptools-autover](https://pypi.org/project/setuptools-autover) = (^1.0.2)
22
- * [luddite](https://pypi.org/project/luddite) = (^1.0.1)
23
- * [packaging](https://pypi.org/project/packaging) = (^20.4)
24
-
25
- ### Installation via Pip on Python 3.6.3+ (recommended method):
26
-
27
- - `$> python3 -m pip install inspy_logger==<version>`
28
-
29
- #### Test out InspyLogger:
30
-
31
- ```python3
32
-
33
- import inspy_logger
34
-
35
- # Set up a log device object. The first parameter is the root loggers name, and the second is the debug level
36
- log_device = inspy_logger.InspyLogger('LogName', 'debug')
37
-
38
- # Start a running log from that device
39
- log = log_device.start()
40
-
41
- # Output our own logger lines:
42
- log.debug('This is a debug log entry')
43
- log.info('This is an info log entry')
44
- log.warning('This is a warning log entry!')
45
- log.error('This is an error log entry!')
46
- log.exception('This is an exception log entry!')
47
-
48
- ```
49
-
50
- If you run the code above you'll get output similar to this:
51
-
52
- ![output1](https://github.com/Inspyre-Softworks/inSPy-Logger/blob/v2.0-alpha.6/examples/v2.0/output_screenies/v2.0.0a.6_screenie1.png)
53
-
54
- v2.0+ repository for inSPy-Logger
1
+ # inSPy-Logger
2
+ ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/Inspyre-Softworks/inSPy-Logger/CI?label=CI&logo=github&logoColor=9cf&style=for-the-badge)
3
+ ![Codacy grade](https://img.shields.io/codacy/grade/7171eec682c549a88dee0da9cc9b92b3?logo=codacy&logoColor=9cf&style=for-the-badge)
4
+ ![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/Inspyre-Softworks/inSPy-Logger?color=9cf&include_prereleases&label=Pre-Release&logo=pypi&logoColor=9cf&style=for-the-badge)
5
+ ![PyPI](https://img.shields.io/pypi/v/inspy-logger?color=9cf&label=Latest&logo=pypi&logoColor=9cf&style=for-the-badge)
6
+ ![GitHub issues](https://img.shields.io/github/issues/Inspyre-Softworks/inSPy-Logger?color=9cf&logo=github&logoColor=9cf&style=for-the-badge)
7
+ ![PyPI - Format](https://img.shields.io/pypi/format/inSPy-Logger?logo=PyPi&style=for-the-badge)
8
+
9
+ ## Installation
10
+
11
+ ### Prerequisites:
12
+
13
+ **Platform/Env**:
14
+ * **Python**: ^3.6.3
15
+ * **PIP**: (_If you want to install via PIP, that is_)
16
+
17
+ **inSPy-Logger Runtime Dependencies**:
18
+ I am providing this list of dependencies for transparency and for instances where one would not be able to install inSPy-Logger via PyPi's package manager. It is **highly** recommended you use `python3 -m pip install inspy_logger==<ver>` to install inSPy-Logger 2.0+
19
+
20
+ * [colorlog](https://pypi.org/project/colorlog) (^4.2.1)
21
+ * [setuptools-autover](https://pypi.org/project/setuptools-autover) = (^1.0.2)
22
+ * [luddite](https://pypi.org/project/luddite) = (^1.0.1)
23
+ * [packaging](https://pypi.org/project/packaging) = (^20.4)
24
+
25
+ ### Installation via Pip on Python 3.6.3+ (recommended method):
26
+
27
+ - `$> python3 -m pip install inspy_logger==<version>`
28
+
29
+ #### Test out InspyLogger:
30
+
31
+ ```python3
32
+
33
+ import inspy_logger
34
+
35
+ # Set up a log device object. The first parameter is the root loggers name, and the second is the debug level
36
+ log_device = inspy_logger.InspyLogger('LogName', 'debug')
37
+
38
+ # Start a running log from that device
39
+ log = log_device.start()
40
+
41
+ # Output our own logger lines:
42
+ log.debug('This is a debug log entry')
43
+ log.info('This is an info log entry')
44
+ log.warning('This is a warning log entry!')
45
+ log.error('This is an error log entry!')
46
+ log.exception('This is an exception log entry!')
47
+
48
+ ```
49
+
50
+ If you run the code above you'll get output similar to this:
51
+
52
+ ![output1](https://github.com/Inspyre-Softworks/inSPy-Logger/blob/v2.0-alpha.6/examples/v2.0/output_screenies/v2.0.0a.6_screenie1.png)
53
+
54
+ v2.0+ repository for inSPy-Logger
@@ -1,20 +1,22 @@
1
1
  """
2
2
 
3
- File:
3
+ File:
4
4
  inspy_logger/Scripts/main.py
5
5
 
6
- Author:
6
+ Author:
7
7
  Inspyre Softworks
8
-
8
+
9
9
  """
10
10
  INSPY_LOG_LEVEL = 'info'
11
11
 
12
+ PROGNAME = 'inspy-logger-tool'
13
+
12
14
  from argparse import ArgumentParser
15
+
13
16
  from inspy_logger.helpers.debug.environment import fetch_system_info
14
- from inspy_logger.version import parse_version, get_full_version_name, PyPiVersionInfo
15
- from rich import print
16
- from rich.table import Table
17
- import sys
17
+ from inspy_logger.version import parse_version, PyPiVersionInfo
18
+
19
+
18
20
 
19
21
  # ---- SET UP PARSER --------------------------------
20
22
 
@@ -37,7 +39,7 @@ update_parser.add_argument('-p', '--pre-release', action='store_true', help='Whe
37
39
  debug_parser = subparsers.add_parser('debug', help='Fetches a collection of environment information to help debug inspy-logger.')
38
40
 
39
41
  debug_parser.add_argument('-C', '--copy-to-clipboard', action='store_true', help='Copies the debug information to the clipboard.')
40
- debug_parser.add_argument('-P', '--print', action='store_true', help='Prints the debug information to the console.', default=True)
42
+ debug_parser.add_argument('-P', '--print', action='store_true', help='Prints the debug information to the console.')
41
43
 
42
44
  # ---- FORMAT FLAGS --------------------------------
43
45
 
@@ -60,46 +62,39 @@ else:
60
62
  INCLUDE_PRE_RELEASE_FOR_UPDATE_CHECK = False
61
63
 
62
64
 
65
+ def get_parser():
66
+ return parser
67
+
68
+
69
+ def debug(args = parsed_args):
70
+ if args.markdown:
71
+ fmt = 'markdown'
72
+ elif args.json:
73
+ fmt = 'json'
74
+ else:
75
+ fmt = 'text'
76
+
77
+ fetch_system_info(copy_to_clipboard=args.copy_to_clipboard, format_type=fmt, print_to_console=args.print)
63
78
 
64
79
 
65
80
 
66
81
  def main():
67
82
 
68
- version = PyPiVersionInfo()
83
+ version = PyPiVersionInfo(INCLUDE_PRE_RELEASE_FOR_UPDATE_CHECK)
69
84
 
70
85
  ACTIONS = {
71
86
  'default': version.print_version_info,
72
87
  'update': version.update,
73
- 'debug': fetch_system_info,
88
+ 'debug': debug,
74
89
 
75
90
  }
76
91
 
77
92
  if parsed_args.subcommand is None:
78
93
  parsed_args.subcommand = 'default'
79
94
 
80
- if parsed_args.subcommand == 'debug':
81
-
82
- if (
83
- parsed_args.markdown
84
- or not parsed_args.json
85
- and not parsed_args.text
86
- ):
87
- fmt = 'markdown'
88
- elif parsed_args.json:
89
- fmt = 'json'
90
- else:
91
- fmt = 'text'
92
-
93
- fetch_system_info(copy_to_clipboard=parsed_args.copy_to_clipboard, format_type=fmt, print_to_console=parsed_args.print)
94
-
95
-
96
-
97
- if parsed_args.subcommand in ACTIONS:
98
- ACTIONS[parsed_args.subcommand]()
99
-
100
-
95
+ # Run the action.
96
+ ACTIONS[parsed_args.subcommand]()
101
97
 
102
- return parsed_args
103
98
 
104
99
  if __name__ == '__main__':
105
100
  main()
@@ -1,21 +1,24 @@
1
- """
2
-
3
- File: inspy_logger/__about__.py
4
- Project: inSPy-Logger
5
- Description:
6
- Holds information about the inSPy-Logger program and its version.
7
-
8
- Created: 11/3/22 - 21:05:06
9
-
10
- Since:
11
- v2.1.1
12
-
13
- """
14
- from inspy_logger.version import parse_version
15
-
16
- __prog__ = 'inSPy-Logger'
17
- __version__ = parse_version()
18
- __authors__ = [
19
- ('Inspyre-Softworks', 'https://inspyre.tech'),
20
- ('Taylor-Jayde Blackstone', '<t.blackstone@inspyre.tech')
21
- ]
1
+ """
2
+
3
+ File: inspy_logger/__about__.py
4
+ Project: inSPy-Logger
5
+ Description:
6
+ Holds information about the inSPy-Logger program and its version.
7
+
8
+ Created: 11/3/22 - 21:05:06
9
+
10
+ Since:
11
+ v2.1.1
12
+
13
+ """
14
+
15
+ from inspy_logger.version import parse_version
16
+
17
+ __PROG__ = 'inSPy-Logger'
18
+ __VERSION__: str = parse_version()
19
+ __AUTHORS__: list[tuple[str, str]] = [
20
+ ('Inspyre-Softworks', 'https://inspyre.tech'),
21
+ ('Taylor-Jayde Blackstone', '<t.blackstone@inspyre.tech')
22
+ ]
23
+
24
+ SOFTWARE_ORG = __AUTHORS__[0][0]
@@ -0,0 +1,138 @@
1
+ #!/usr/bin/env python3
2
+ import contextlib
3
+ import sys
4
+ import inspect
5
+ import logging
6
+ from pypattyrn.behavioral.null import Null
7
+ from inspy_logger.common import PROG_NAME as ISL_PROG_NAME, DEFAULT_LOGGING_LEVEL, DEFAULT_LOG_FILE_PATH, LEVELS
8
+ from inspy_logger.helpers import find_variable_in_call_stack, check_preemptive_level_set, find_argument_parser, determine_start_block, determine_level
9
+
10
+ from inspy_logger.helpers import (
11
+ translate_to_logging_level,
12
+ clean_module_name,
13
+ CustomFormatter,
14
+ determine_client_prog_name,
15
+ determine_log_file_path
16
+ )
17
+
18
+ # Existing log record factory
19
+ old_factory = logging.getLogRecordFactory()
20
+
21
+
22
+ def record_factory(*args, **kwargs):
23
+ record = old_factory(*args, **kwargs)
24
+ # Set the file_name attribute to the name of the file where the log is called
25
+ frame = inspect.stack()[1]
26
+ record.file_name = frame.filename
27
+ return record
28
+
29
+
30
+ logging.setLogRecordFactory(record_factory)
31
+
32
+
33
+ from inspy_logger.engine import Logger
34
+ from inspy_logger.helpers import get_existing_logger
35
+
36
+ __all__ = [
37
+ "clean_module_name",
38
+ "CustomFormatter",
39
+ "DEFAULT_LOGGING_LEVEL",
40
+ "determine_level",
41
+ "InspyLogger",
42
+ "LOG_DEVICE",
43
+ "Logger",
44
+ "ISL_PROG_NAME",
45
+ "translate_to_logging_level",
46
+ ]
47
+
48
+ BLOCKED = determine_start_block()
49
+
50
+ LOG_FILE = determine_log_file_path()
51
+
52
+ LOG_DEVICE = None if BLOCKED else Logger(ISL_PROG_NAME)
53
+
54
+ MODULE_OBJ = sys.modules[__name__]
55
+
56
+ CLIENT_PROG_NAME = determine_client_prog_name()
57
+
58
+ INIT_LOG_LEVEL = determine_level(CLIENT_PROG_NAME)
59
+
60
+ INTERACTIVE_SESSION = find_variable_in_call_stack('INSPY_INTERACTIVE_SESSION', default=False)
61
+
62
+
63
+ def start_logger(override_block=True):
64
+ """
65
+ Starts the logger.
66
+
67
+ Parameters:
68
+ override_block (Union[bool, None], optional):
69
+ A flag to override the block on the logger. Defaults to True.
70
+
71
+ Note:
72
+ You only need to run this function if you have blocked the logger from starting automatically.
73
+
74
+ Returns:
75
+
76
+ """
77
+ global LOG_DEVICE
78
+ global CLIENT_PROG_NAME
79
+ global INIT_LOG_LEVEL
80
+
81
+ if not BLOCKED or override_block:
82
+ LOG_DEVICE = Logger(ISL_PROG_NAME)
83
+ LOG_DEVICE.set_level(INIT_LOG_LEVEL)
84
+
85
+ if CLIENT_PROG_NAME:
86
+
87
+ prog_logger = Logger(
88
+ CLIENT_PROG_NAME,
89
+ LOG_DEVICE.console_level,
90
+ LOG_DEVICE.file_level,
91
+ file_name=DEFAULT_LOG_FILE_PATH.name,
92
+ file_path=DEFAULT_LOG_FILE_PATH.parent
93
+ )
94
+ __all__.append('PROG_LOGGER')
95
+
96
+ LOG_DEVICE.replay_and_setup_handlers()
97
+ elif CLIENT_PROG_NAME:
98
+ prog_logger = Null()
99
+
100
+ with contextlib.suppress(NameError):
101
+ global PROG_LOGGER
102
+
103
+ PROG_LOGGER = prog_logger
104
+
105
+ if isinstance(PROG_LOGGER, Null):
106
+ from rich import print
107
+ print("The logger has been blocked from starting. To start the logger, run `start_logger()`.")
108
+
109
+
110
+ InspyLogger = Logger
111
+
112
+
113
+ def _get_loggable():
114
+ from inspy_logger.helpers.base_classes import Loggable
115
+ import bisect
116
+ # Add the `Loggable` class to `__all__` in alphabetical order.
117
+ bisect.insort(__all__, 'Loggable')
118
+
119
+ return Loggable
120
+
121
+
122
+ Loggable = _get_loggable()
123
+
124
+
125
+ start_logger(override_block=False)
126
+
127
+
128
+ deprecation_warning_deliveries = 0
129
+
130
+
131
+ def getLogger(*args, **kwargs):
132
+ global deprecation_warning_deliveries
133
+
134
+ if deprecation_warning_deliveries < 5:
135
+ LOG_DEVICE.warning('The `getLogger` function is deprecated. Use `InspyLogger` instead.')
136
+ deprecation_warning_deliveries += 1
137
+
138
+ return InspyLogger(*args, **kwargs)
@@ -0,0 +1,120 @@
1
+ """
2
+ Defines the logging configuration and constants used within the inSPy-Logger project. It includes the mapping of log
3
+ levels, default settings, and the `InspyLogger` class which is a central part of the logging framework.
4
+
5
+ Constants:
6
+ PROG_NAME (str):
7
+ The program name, imported from the project's :mod:`inspy_logger.__about__` module.
8
+
9
+ PROG_VERSION (str):
10
+ The program version, imported from the project's `__about__` module.
11
+
12
+ LEVEL_MAP (dict):
13
+ A dictionary mapping string representations of logging levels to their corresponding logging module constants.
14
+
15
+ LEVELS (list):
16
+ A list of available logging levels derived from `LEVEL_MAP`.
17
+
18
+ DEFAULT_LOGGING_LEVEL (logging level):
19
+ The default logging level used throughout the project.
20
+
21
+ DEFAULT_LOG_FILE_PATH (path):
22
+ The default path where log files are stored, defined in `inspy_logger.common.dirs`.
23
+
24
+ Classes:
25
+ InspyLogger:
26
+ A placeholder for the logging class used in the inSPy-Logger project.
27
+
28
+ Dependencies:
29
+ - logging:
30
+ Used to define the logging levels and to be used in the `InspyLogger` class for actual logging.
31
+
32
+ - :mod:`inspy_logger.__about__`:
33
+ Provides metadata like program name and version, which are used in logging for contextual information.
34
+
35
+ - inspy_logger.common.dirs:
36
+ Provides common directory paths used in the logger, including the default log file path.
37
+
38
+ """
39
+ from abc import ABC, abstractmethod
40
+ import logging
41
+
42
+ from inspy_logger.__about__ import __PROG__ as PROG_NAME, __VERSION__ as PROG_VERSION
43
+ from inspy_logger.config.dirs import DEFAULT_LOG_FILE_PATH
44
+ from inspy_logger.constants import LEVEL_MAP
45
+
46
+ __all__ = [
47
+ "PROG_NAME",
48
+ "PROG_VERSION",
49
+ "LEVEL_MAP",
50
+ "LEVEL_NAMES",
51
+ "LEVELS",
52
+ "DEFAULT_LOGGING_LEVEL",
53
+ "DEFAULT_LOG_FILE_PATH",
54
+ "InspyLogger"
55
+ ]
56
+
57
+
58
+ LEVELS = list(LEVEL_MAP.values())
59
+ """The list of level names."""
60
+
61
+ LEVEL_NAMES = [level.upper() for level in LEVEL_MAP.keys()]
62
+ """The list of level names in uppercase."""
63
+
64
+
65
+ DEFAULT_LOGGING_LEVEL = logging.INFO
66
+ """The default logging level."""
67
+
68
+
69
+ class InspyLogger(ABC):
70
+
71
+ @property
72
+ @abstractmethod
73
+ def children(self):
74
+ pass
75
+
76
+ @property
77
+ @abstractmethod
78
+ def console_level(self):
79
+ pass
80
+
81
+ @property
82
+ @abstractmethod
83
+ def name(self):
84
+ pass
85
+
86
+ @property
87
+ @abstractmethod
88
+ def file_level(self):
89
+ pass
90
+
91
+ @property
92
+ @abstractmethod
93
+ def file_path(self):
94
+ pass
95
+
96
+ @property
97
+ @abstractmethod
98
+ def time_started(self):
99
+ pass
100
+
101
+ @property
102
+ @abstractmethod
103
+ def to_dict(self):
104
+ pass
105
+
106
+ @abstractmethod
107
+ def debug(self, message):
108
+ pass
109
+
110
+ @abstractmethod
111
+ def info(self, message):
112
+ pass
113
+
114
+ @abstractmethod
115
+ def warning(self, message):
116
+ pass
117
+
118
+ @abstractmethod
119
+ def error(self, message):
120
+ pass
@@ -0,0 +1,45 @@
1
+ __all__ = [
2
+ 'SOFTWARE_ORG',
3
+ 'SOFTWARE_ORG_URL',
4
+ 'AUTHORS',
5
+ 'PROG_NAME',
6
+ 'RELEASE_MAP',
7
+ 'URLS',
8
+ 'VERSION'
9
+ ]
10
+
11
+ PROG_NAME = 'inSPy-Logger'
12
+
13
+ URLS = dict(
14
+ developer_url='https://inspyre.tech',
15
+ docs_url='https://inspyre-toolbox.readthedocs.io/en/latest',
16
+ github_url='https://github.com/tayjaybabee/Inspyre-Toolbox',
17
+ pypi_url='https://pypi.org/project/inspyre-toolbox',
18
+ )
19
+ """The URLs used in the project."""
20
+
21
+ AUTHORS = [
22
+ ('Inspyre-Softworks', URLS['developer_url']),
23
+ ('Taylor-Jayde Blackstone', '<t.blackstone@inspyre.tech>')
24
+ ]
25
+ """The authors of the project."""
26
+
27
+ SOFTWARE_ORG, SOFTWARE_ORG_URL = AUTHORS[0]
28
+
29
+ RELEASE_MAP = {
30
+ 'dev': 'Development Build',
31
+ 'alpha': 'Alpha Build',
32
+ 'beta': 'Beta Build',
33
+ 'rc': 'Release Candidate Build',
34
+ 'final': 'Final Release Build'
35
+ }
36
+ """The release map for the project."""
37
+
38
+ VERSION = {
39
+ 'major': 3,
40
+ 'minor': 1,
41
+ 'patch': 0,
42
+ 'release': 'final',
43
+ 'release_num': 0
44
+ }
45
+ """The version information for the project."""
@@ -0,0 +1,18 @@
1
+ """
2
+
3
+
4
+ Author:
5
+ Inspyre Softworks
6
+
7
+ Project:
8
+ inSPy-Logger
9
+
10
+ File:
11
+ inspy_logger/config/__init__.py
12
+
13
+
14
+ Description:
15
+
16
+
17
+ """
18
+ from inspy_logger.config.dirs import DEFAULT_LOG_FILE_PATH