ipulse-shared-core-ftredge 2.15__tar.gz → 2.17__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.

Potentially problematic release.


This version of ipulse-shared-core-ftredge might be problematic. Click here for more details.

Files changed (25) hide show
  1. {ipulse_shared_core_ftredge-2.15/src/ipulse_shared_core_ftredge.egg-info → ipulse_shared_core_ftredge-2.17}/PKG-INFO +4 -2
  2. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/setup.py +4 -2
  3. ipulse_shared_core_ftredge-2.17/src/ipulse_shared_core_ftredge/gcp_logger.py +76 -0
  4. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17/src/ipulse_shared_core_ftredge.egg-info}/PKG-INFO +4 -2
  5. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/src/ipulse_shared_core_ftredge.egg-info/SOURCES.txt +1 -0
  6. ipulse_shared_core_ftredge-2.17/src/ipulse_shared_core_ftredge.egg-info/requires.txt +5 -0
  7. ipulse_shared_core_ftredge-2.15/src/ipulse_shared_core_ftredge.egg-info/requires.txt +0 -3
  8. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/LICENCE +0 -0
  9. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/README.md +0 -0
  10. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/pyproject.toml +0 -0
  11. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/setup.cfg +0 -0
  12. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/src/ipulse_shared_core_ftredge/__init__.py +0 -0
  13. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/src/ipulse_shared_core_ftredge/models/__init__.py +0 -0
  14. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/src/ipulse_shared_core_ftredge/models/audit_log_firestore.py +0 -0
  15. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/src/ipulse_shared_core_ftredge/models/organisation.py +0 -0
  16. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/src/ipulse_shared_core_ftredge/models/pulse_enums.py +0 -0
  17. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/src/ipulse_shared_core_ftredge/models/resource_catalog_item.py +0 -0
  18. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/src/ipulse_shared_core_ftredge/models/user_auth.py +0 -0
  19. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/src/ipulse_shared_core_ftredge/models/user_profile.py +0 -0
  20. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/src/ipulse_shared_core_ftredge/models/user_profile_update.py +0 -0
  21. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/src/ipulse_shared_core_ftredge/models/user_status.py +0 -0
  22. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/src/ipulse_shared_core_ftredge/tests/__init__.py +0 -0
  23. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/src/ipulse_shared_core_ftredge/tests/test.py +0 -0
  24. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/src/ipulse_shared_core_ftredge.egg-info/dependency_links.txt +0 -0
  25. {ipulse_shared_core_ftredge-2.15 → ipulse_shared_core_ftredge-2.17}/src/ipulse_shared_core_ftredge.egg-info/top_level.txt +0 -0
@@ -1,10 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipulse_shared_core_ftredge
3
- Version: 2.15
4
- Summary: Shared models for the Pulse platform project. Using AI for financial advisory and investment management.
3
+ Version: 2.17
4
+ Summary: Shared Core models and Logger util for the Pulse platform project. Using AI for financial advisory and investment management.
5
5
  Home-page: https://github.com/TheFutureEdge/ipulse_shared_core
6
6
  Author: Russlan Ramdowar
7
7
  License-File: LICENCE
8
8
  Requires-Dist: pydantic[email]~=2.5
9
9
  Requires-Dist: python-dateutil~=2.8
10
10
  Requires-Dist: pytest~=7.1
11
+ Requires-Dist: google-cloud-logging~=3.10.0
12
+ Requires-Dist: google-cloud-error-reporting~=1.11.0
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='ipulse_shared_core_ftredge',
5
- version='2.15',
5
+ version='2.17',
6
6
  package_dir={'': 'src'}, # Specify the source directory
7
7
  packages=find_packages(where='src'), # Look for packages in 'src'
8
8
  install_requires=[
@@ -10,8 +10,10 @@ setup(
10
10
  'pydantic[email]~=2.5',
11
11
  'python-dateutil~=2.8',
12
12
  'pytest~=7.1',
13
+ 'google-cloud-logging~=3.10.0',
14
+ 'google-cloud-error-reporting~=1.11.0'
13
15
  ],
14
16
  author='Russlan Ramdowar',
15
- description='Shared models for the Pulse platform project. Using AI for financial advisory and investment management.',
17
+ description='Shared Core models and Logger util for the Pulse platform project. Using AI for financial advisory and investment management.',
16
18
  url='https://github.com/TheFutureEdge/ipulse_shared_core',
17
19
  )
@@ -0,0 +1,76 @@
1
+ import logging
2
+ import os
3
+ import traceback
4
+ from google.cloud import error_reporting, logging as cloud_logging
5
+
6
+
7
+ ############################################################################
8
+ ##################### SETTING UP LOGGER ####################################
9
+
10
+ ####DEPCREACATED: THIS APPROACH WAS GOOD, BUT ERRORS WERE NOT REPORTED TO ERROR REPORTING
11
+
12
+ # logging.basicConfig(level=logging.INFO)
13
+ # logging_client = google.cloud.logging.Client()
14
+ # # Retrieves a Cloud Logging handler based on the environment
15
+ # # you're running in and integrates the handler with the
16
+ # # Python logging module. By default this captures all logs
17
+ # # at INFO level and higher
18
+ # logging_client.setup_logging()
19
+ ###################################
20
+
21
+ ##### THIS APPROACH IS USED NOW ########
22
+ ## TODO Fix the issue with POST 0B Nan.... printed in Cloud Logging , which is referring to posting to Cloud Logging probably.
23
+
24
+ ENV = os.getenv('ENV', 'LOCAL').strip("'")
25
+
26
+ def setup_logger(logger_name):
27
+ """Sets up a logger with Error Reporting and Cloud Logging handlers.
28
+
29
+ Args:
30
+ logger_name: The name of the logger.
31
+
32
+ Returns:
33
+ logging.Logger: The configured logger instance.
34
+ """
35
+
36
+ class ErrorReportingHandler(logging.Handler):
37
+ def __init__(self, level=logging.ERROR):
38
+ super().__init__(level)
39
+ self.error_client = error_reporting.Client()
40
+ self.propagate = True
41
+
42
+ def emit(self, record):
43
+ try:
44
+ if record.levelno >= logging.ERROR:
45
+ message = self.format(record)
46
+ if record.exc_info:
47
+ message += "\n" + ''.join(traceback.format_exception(*record.exc_info))
48
+ if hasattr(record, 'pathname') and hasattr(record, 'lineno'):
49
+ message += f"\nFile: {record.pathname}, Line: {record.lineno}"
50
+ self.error_client.report(message)
51
+ except Exception as e:
52
+ # Ensure no exceptions are raised during logging
53
+ self.handleError(record)
54
+
55
+ logger = logging.getLogger(logger_name)
56
+ logger.setLevel(logging.INFO)
57
+
58
+ # Create Error Reporting handler
59
+ error_reporting_handler = ErrorReportingHandler()
60
+
61
+ # Create Google Cloud Logging handler
62
+ cloud_logging_client = cloud_logging.Client()
63
+ cloud_logging_handler = cloud_logging_client.get_default_handler()
64
+
65
+ # Add handlers to the logger
66
+ logger.addHandler(error_reporting_handler)
67
+ logger.addHandler(cloud_logging_handler)
68
+
69
+ # Add a console handler for local development
70
+ if ENV == "LOCAL":
71
+ formatter = logging.Formatter('%(levelname)s : %(name)s : %(asctime)s : %(message)s')
72
+ console_handler = logging.StreamHandler()
73
+ console_handler.setFormatter(formatter)
74
+ logger.addHandler(console_handler)
75
+
76
+ return logger
@@ -1,10 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipulse_shared_core_ftredge
3
- Version: 2.15
4
- Summary: Shared models for the Pulse platform project. Using AI for financial advisory and investment management.
3
+ Version: 2.17
4
+ Summary: Shared Core models and Logger util for the Pulse platform project. Using AI for financial advisory and investment management.
5
5
  Home-page: https://github.com/TheFutureEdge/ipulse_shared_core
6
6
  Author: Russlan Ramdowar
7
7
  License-File: LICENCE
8
8
  Requires-Dist: pydantic[email]~=2.5
9
9
  Requires-Dist: python-dateutil~=2.8
10
10
  Requires-Dist: pytest~=7.1
11
+ Requires-Dist: google-cloud-logging~=3.10.0
12
+ Requires-Dist: google-cloud-error-reporting~=1.11.0
@@ -3,6 +3,7 @@ README.md
3
3
  pyproject.toml
4
4
  setup.py
5
5
  src/ipulse_shared_core_ftredge/__init__.py
6
+ src/ipulse_shared_core_ftredge/gcp_logger.py
6
7
  src/ipulse_shared_core_ftredge.egg-info/PKG-INFO
7
8
  src/ipulse_shared_core_ftredge.egg-info/SOURCES.txt
8
9
  src/ipulse_shared_core_ftredge.egg-info/dependency_links.txt
@@ -0,0 +1,5 @@
1
+ pydantic[email]~=2.5
2
+ python-dateutil~=2.8
3
+ pytest~=7.1
4
+ google-cloud-logging~=3.10.0
5
+ google-cloud-error-reporting~=1.11.0
@@ -1,3 +0,0 @@
1
- pydantic[email]~=2.5
2
- python-dateutil~=2.8
3
- pytest~=7.1