maleo-foundation 0.3.36__tar.gz → 0.3.38__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 (144) hide show
  1. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/PKG-INFO +1 -1
  2. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/enums.py +7 -26
  3. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/managers/db.py +3 -3
  4. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/managers/service.py +23 -14
  5. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/general/configurations/__init__.py +14 -5
  6. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/general/configurations/cache/redis.py +1 -1
  7. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/logging.py +74 -10
  8. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation.egg-info/PKG-INFO +1 -1
  9. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/pyproject.toml +1 -1
  10. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/README.md +0 -0
  11. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/__init__.py +0 -0
  12. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/authentication.py +0 -0
  13. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/authorization.py +0 -0
  14. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/client/__init__.py +0 -0
  15. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/client/manager.py +0 -0
  16. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/client/services/__init__.py +0 -0
  17. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/client/services/encryption/__init__.py +0 -0
  18. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/client/services/encryption/aes.py +0 -0
  19. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/client/services/encryption/rsa.py +0 -0
  20. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/client/services/hash/__init__.py +0 -0
  21. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/client/services/hash/bcrypt.py +0 -0
  22. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/client/services/hash/hmac.py +0 -0
  23. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/client/services/hash/sha256.py +0 -0
  24. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/client/services/key.py +0 -0
  25. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/client/services/signature.py +0 -0
  26. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/client/services/token.py +0 -0
  27. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/constants.py +0 -0
  28. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/expanded_types/__init__.py +0 -0
  29. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/expanded_types/client.py +0 -0
  30. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/expanded_types/encryption/__init__.py +0 -0
  31. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/expanded_types/encryption/aes.py +0 -0
  32. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/expanded_types/encryption/rsa.py +0 -0
  33. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/expanded_types/general.py +0 -0
  34. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/expanded_types/hash.py +0 -0
  35. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/expanded_types/key.py +0 -0
  36. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/expanded_types/repository.py +0 -0
  37. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/expanded_types/service.py +0 -0
  38. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/expanded_types/signature.py +0 -0
  39. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/expanded_types/token.py +0 -0
  40. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/extended_types.py +0 -0
  41. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/managers/__init__.py +0 -0
  42. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/managers/cache.py +0 -0
  43. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/managers/client/__init__.py +0 -0
  44. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/managers/client/base.py +0 -0
  45. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/managers/client/google/__init__.py +0 -0
  46. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/managers/client/google/base.py +0 -0
  47. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/managers/client/google/parameter.py +0 -0
  48. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/managers/client/google/secret.py +0 -0
  49. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/managers/client/google/storage.py +0 -0
  50. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/managers/client/google/subscription.py +0 -0
  51. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/managers/client/maleo.py +0 -0
  52. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/managers/configuration.py +0 -0
  53. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/managers/credential.py +0 -0
  54. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/managers/middleware.py +0 -0
  55. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/middlewares/authentication.py +0 -0
  56. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/middlewares/base.py +0 -0
  57. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/middlewares/cors.py +0 -0
  58. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/__init__.py +0 -0
  59. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/responses.py +0 -0
  60. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/schemas/__init__.py +0 -0
  61. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/schemas/encryption.py +0 -0
  62. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/schemas/general.py +0 -0
  63. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/schemas/hash.py +0 -0
  64. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/schemas/key.py +0 -0
  65. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/schemas/parameter.py +0 -0
  66. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/schemas/result.py +0 -0
  67. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/schemas/signature.py +0 -0
  68. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/schemas/token.py +0 -0
  69. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/table.py +0 -0
  70. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/__init__.py +0 -0
  71. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/general/__init__.py +0 -0
  72. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/general/configurations/cache/__init__.py +0 -0
  73. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/general/configurations/client/__init__.py +0 -0
  74. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/general/configurations/client/maleo.py +0 -0
  75. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/general/configurations/database.py +0 -0
  76. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/general/configurations/middleware.py +0 -0
  77. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/general/configurations/service.py +0 -0
  78. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/general/credentials.py +0 -0
  79. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/general/database.py +0 -0
  80. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/general/key.py +0 -0
  81. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/general/request.py +0 -0
  82. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/general/settings.py +0 -0
  83. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/general/signature.py +0 -0
  84. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/general/token.py +0 -0
  85. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/parameters/__init__.py +0 -0
  86. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/parameters/client.py +0 -0
  87. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/parameters/encryption/__init__.py +0 -0
  88. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/parameters/encryption/aes.py +0 -0
  89. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/parameters/encryption/rsa.py +0 -0
  90. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/parameters/general.py +0 -0
  91. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/parameters/hash/__init__.py +0 -0
  92. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/parameters/hash/bcrypt.py +0 -0
  93. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/parameters/hash/hmac.py +0 -0
  94. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/parameters/hash/sha256.py +0 -0
  95. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/parameters/key.py +0 -0
  96. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/parameters/service.py +0 -0
  97. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/parameters/signature.py +0 -0
  98. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/parameters/token.py +0 -0
  99. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/results/__init__.py +0 -0
  100. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/results/client/__init__.py +0 -0
  101. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/results/client/controllers/__init__.py +0 -0
  102. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/results/client/controllers/http.py +0 -0
  103. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/results/client/service.py +0 -0
  104. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/results/encryption/__init__.py +0 -0
  105. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/results/encryption/aes.py +0 -0
  106. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/results/encryption/rsa.py +0 -0
  107. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/results/hash.py +0 -0
  108. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/results/key.py +0 -0
  109. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/results/service/__init__.py +0 -0
  110. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/results/service/controllers/__init__.py +0 -0
  111. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/results/service/controllers/rest.py +0 -0
  112. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/results/service/general.py +0 -0
  113. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/results/service/repository.py +0 -0
  114. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/results/signature.py +0 -0
  115. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/models/transfers/results/token.py +0 -0
  116. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/rest_controller_result.py +0 -0
  117. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/types.py +0 -0
  118. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/__init__.py +0 -0
  119. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/cache.py +0 -0
  120. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/client.py +0 -0
  121. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/controller.py +0 -0
  122. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/dependencies/__init__.py +0 -0
  123. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/dependencies/auth.py +0 -0
  124. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/dependencies/context.py +0 -0
  125. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/exceptions.py +0 -0
  126. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/extractor.py +0 -0
  127. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/formatter/__init__.py +0 -0
  128. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/formatter/case.py +0 -0
  129. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/loaders/__init__.py +0 -0
  130. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/loaders/credential/__init__.py +0 -0
  131. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/loaders/credential/google.py +0 -0
  132. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/loaders/json.py +0 -0
  133. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/loaders/key/__init__.py +0 -0
  134. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/loaders/key/rsa.py +0 -0
  135. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/loaders/yaml.py +0 -0
  136. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/merger.py +0 -0
  137. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/query.py +0 -0
  138. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/repository.py +0 -0
  139. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation/utils/searcher.py +0 -0
  140. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation.egg-info/SOURCES.txt +0 -0
  141. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation.egg-info/dependency_links.txt +0 -0
  142. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation.egg-info/requires.txt +0 -0
  143. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/maleo_foundation.egg-info/top_level.txt +0 -0
  144. {maleo_foundation-0.3.36 → maleo_foundation-0.3.38}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.3.36
3
+ Version: 0.3.38
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -126,17 +126,14 @@ class BaseEnums:
126
126
  BaseEnums.RESTControllerResponseType.FILE: responses.FileResponse,
127
127
  }.get(self, responses.Response)
128
128
 
129
- class ServiceLoggerType(StrEnum):
130
- REPOSITORY = "repository"
131
- DATABASE = "database"
132
- APPLICATION = "application"
133
-
134
129
  class LoggerType(StrEnum):
135
- MIDDLEWARE = "middleware"
136
- REPOSITORY = "repository"
137
- DATABASE = "database"
138
130
  APPLICATION = "application"
131
+ CACHE = "cache"
139
132
  CLIENT = "client"
133
+ DATABASE = "database"
134
+ MIDDLEWARE = "middleware"
135
+ REPOSITORY = "repository"
136
+ SERVICE = "service"
140
137
 
141
138
  class LoggerLevel(IntEnum):
142
139
  CRITICAL = logging.CRITICAL
@@ -148,26 +145,10 @@ class BaseEnums:
148
145
  DEBUG = logging.DEBUG
149
146
  NOTSET = logging.NOTSET
150
147
 
151
- class CacheType(StrEnum):
148
+ class CacheLayer(StrEnum):
149
+ CLIENT = "client"
152
150
  REPOSITORY = "repository"
153
151
  ROUTER = "router"
154
- CLIENT = "client"
155
-
156
- class CacheTTL(IntEnum):
157
- TTL_15SC = int(15)
158
- TTL_30SC = int(30)
159
- TTL_1MN = int(1*60)
160
- TTL_5MN = int(5*60)
161
- TTL_10MN = int(10*60)
162
- TTL_30MN = int(30*60)
163
- TTL_1HR = int(1*60*60)
164
- TTL_6HR = int(6*60*60)
165
- TTL_12HR = int(12*60*60)
166
- TTL_1DY = int(1*24*60*60)
167
- TTL_3DY = int(3*24*60*60)
168
- TTL_1WK = int(1*7*24*60*60)
169
- TTL_2WK = int(2*7*24*60*60)
170
- TTL_1MO = int(1*30*24*60*60)
171
152
 
172
153
  class Expiration(IntEnum):
173
154
  EXP_15SC = int(15)
@@ -8,7 +8,7 @@ from sqlalchemy.ext.declarative import DeclarativeMeta
8
8
  from sqlalchemy.orm import sessionmaker, Session, declarative_base
9
9
  from typing import Generator
10
10
  from maleo_foundation.types import BaseTypes
11
- from maleo_foundation.utils.logging import ServiceLogger
11
+ from maleo_foundation.utils.logging import DatabaseLogger
12
12
 
13
13
  class MetadataManager:
14
14
  Base: DeclarativeMeta = declarative_base()
@@ -17,7 +17,7 @@ class MetadataManager:
17
17
  class SessionManager:
18
18
  def __init__(
19
19
  self,
20
- logger: ServiceLogger,
20
+ logger: DatabaseLogger,
21
21
  engine: Engine
22
22
  ):
23
23
  self._logger = logger
@@ -80,7 +80,7 @@ class DatabaseManager:
80
80
  def __init__(
81
81
  self,
82
82
  metadata: MetaData,
83
- logger: ServiceLogger,
83
+ logger: DatabaseLogger,
84
84
  url: BaseTypes.OptionalString = None
85
85
  ):
86
86
  self._metadata = metadata #* Define database metadata
@@ -30,8 +30,12 @@ from maleo_foundation.types import BaseTypes
30
30
  from maleo_foundation.utils.exceptions import BaseExceptions
31
31
  from maleo_foundation.utils.logging import (
32
32
  SimpleConfig,
33
- ServiceLogger,
34
- MiddlewareLogger
33
+ ApplicationLogger,
34
+ CacheLogger,
35
+ DatabaseLogger,
36
+ MiddlewareLogger,
37
+ RepositoryLogger,
38
+ ServiceLogger
35
39
  )
36
40
  from .credential import CredentialManager
37
41
  from .configuration import ConfigurationManager
@@ -119,32 +123,37 @@ class ServiceManager:
119
123
  return self._keys
120
124
 
121
125
  def _initialize_loggers(self) -> None:
122
- #* Service's loggers
123
- application = ServiceLogger(
124
- type=BaseEnums.LoggerType.APPLICATION,
126
+ application = ApplicationLogger(
125
127
  service_key=self.configurations.service.key,
126
128
  **self._log_config.model_dump()
127
129
  )
128
- database = ServiceLogger(
129
- type=BaseEnums.LoggerType.DATABASE,
130
+ cache = CacheLogger(
130
131
  service_key=self.configurations.service.key,
131
132
  **self._log_config.model_dump()
132
133
  )
133
- repository = ServiceLogger(
134
- type=BaseEnums.LoggerType.REPOSITORY,
134
+ database = DatabaseLogger(
135
135
  service_key=self.configurations.service.key,
136
136
  **self._log_config.model_dump()
137
137
  )
138
- #* Middleware's logger
139
138
  middleware = MiddlewareLogger(
140
139
  service_key=self.configurations.service.key,
141
140
  **self._log_config.model_dump()
142
141
  )
142
+ repository = RepositoryLogger(
143
+ service_key=self.configurations.service.key,
144
+ **self._log_config.model_dump()
145
+ )
146
+ service = ServiceLogger(
147
+ service_key=self.configurations.service.key,
148
+ **self._log_config.model_dump()
149
+ )
143
150
  self._loggers = Loggers(
144
151
  application=application,
145
- repository=repository,
152
+ cache=cache,
146
153
  database=database,
147
- middleware=middleware
154
+ middleware=middleware,
155
+ repository=repository,
156
+ service=service
148
157
  )
149
158
 
150
159
  @property
@@ -163,10 +172,10 @@ class ServiceManager:
163
172
  async def check_redis_connection(self) -> bool:
164
173
  try:
165
174
  await self._redis.ping()
166
- self._loggers.application.info("Redis connection check successful.")
175
+ self._loggers.cache.info("Redis connection check successful.")
167
176
  return True
168
177
  except RedisError as e:
169
- self._loggers.application.error(f"Redis connection check failed: {e}", exc_info=True)
178
+ self._loggers.cache.error(f"Redis connection check failed: {e}", exc_info=True)
170
179
  return False
171
180
 
172
181
  async def initialize_cache(self) -> None:
@@ -1,5 +1,12 @@
1
1
  from pydantic import BaseModel, ConfigDict, Field
2
- from maleo_foundation.utils.logging import MiddlewareLogger, ServiceLogger
2
+ from maleo_foundation.utils.logging import (
3
+ ApplicationLogger,
4
+ CacheLogger,
5
+ DatabaseLogger,
6
+ MiddlewareLogger,
7
+ RepositoryLogger,
8
+ ServiceLogger
9
+ )
3
10
  from .cache import CacheConfigurations
4
11
  from .client import ClientConfigurations
5
12
  from .database import DatabaseConfigurations
@@ -18,7 +25,9 @@ class Configurations(BaseModel):
18
25
  class Loggers(BaseModel):
19
26
  model_config = ConfigDict(arbitrary_types_allowed=True)
20
27
 
21
- application: ServiceLogger = Field(..., description="Application logger")
22
- repository: ServiceLogger = Field(..., description="Repository logger")
23
- database: ServiceLogger = Field(..., description="Database logger")
24
- middleware: MiddlewareLogger = Field(..., description="Middleware logger")
28
+ application: ApplicationLogger = Field(..., description="Application logger")
29
+ cache: CacheLogger = Field(..., description="Cache logger")
30
+ database: DatabaseLogger = Field(..., description="Database logger")
31
+ middleware: MiddlewareLogger = Field(..., description="Middleware logger")
32
+ repository: RepositoryLogger = Field(..., description="Repository logger")
33
+ service: ServiceLogger = Field(..., description="Service logger")
@@ -9,7 +9,7 @@ class RedisCacheNamespaces(BaseModel):
9
9
  def create(
10
10
  self,
11
11
  *ext: str,
12
- type: BaseEnums.CacheType,
12
+ type: BaseEnums.CacheLayer,
13
13
  base_override: BaseTypes.OptionalString = None
14
14
  ) -> str:
15
15
  return ":".join([self.base if base_override is None else base_override, type, *ext])
@@ -72,9 +72,6 @@ class BaseLogger(logging.Logger):
72
72
 
73
73
  #* Define logger name
74
74
  if self._type == BaseEnums.LoggerType.CLIENT:
75
- #* Ensure client_key is valid if logger type is client
76
- if self._client_key is None:
77
- raise ValueError("'client_key' parameter must be provided if 'logger_type' is 'client'")
78
75
  self._name = f"{self._service_key} - {self._type} - {self._client_key}"
79
76
  else:
80
77
  self._name = f"{self._service_key} - {self._type}"
@@ -145,35 +142,34 @@ class BaseLogger(logging.Logger):
145
142
  handler.close()
146
143
  self.handlers.clear()
147
144
 
148
- class MiddlewareLogger(BaseLogger):
145
+ class ApplicationLogger(BaseLogger):
149
146
  def __init__(
150
147
  self,
151
148
  dir: str,
152
149
  service_key: BaseTypes.OptionalString = None,
153
- level = BaseEnums.LoggerLevel.INFO,
154
- google_cloud_logging = None
150
+ level: BaseEnums.LoggerLevel = BaseEnums.LoggerLevel.INFO,
151
+ google_cloud_logging: Optional[GoogleCloudLogging] = None
155
152
  ):
156
153
  super().__init__(
157
154
  dir=dir,
158
- type=BaseEnums.LoggerType.MIDDLEWARE,
155
+ type=BaseEnums.LoggerType.APPLICATION,
159
156
  service_key=service_key,
160
157
  client_key=None,
161
158
  level=level,
162
159
  google_cloud_logging=google_cloud_logging
163
160
  )
164
161
 
165
- class ServiceLogger(BaseLogger):
162
+ class CacheLogger(BaseLogger):
166
163
  def __init__(
167
164
  self,
168
165
  dir: str,
169
- type: BaseEnums.ServiceLoggerType,
170
166
  service_key: BaseTypes.OptionalString = None,
171
167
  level: BaseEnums.LoggerLevel = BaseEnums.LoggerLevel.INFO,
172
168
  google_cloud_logging: Optional[GoogleCloudLogging] = None
173
169
  ):
174
170
  super().__init__(
175
171
  dir=dir,
176
- type=type,
172
+ type=BaseEnums.LoggerType.CACHE,
177
173
  service_key=service_key,
178
174
  client_key=None,
179
175
  level=level,
@@ -196,4 +192,72 @@ class ClientLogger(BaseLogger):
196
192
  client_key=client_key,
197
193
  level=level,
198
194
  google_cloud_logging=google_cloud_logging
195
+ )
196
+
197
+ class DatabaseLogger(BaseLogger):
198
+ def __init__(
199
+ self,
200
+ dir: str,
201
+ service_key: BaseTypes.OptionalString = None,
202
+ level = BaseEnums.LoggerLevel.INFO,
203
+ google_cloud_logging = None
204
+ ):
205
+ super().__init__(
206
+ dir=dir,
207
+ type=BaseEnums.LoggerType.DATABASE,
208
+ service_key=service_key,
209
+ client_key=None,
210
+ level=level,
211
+ google_cloud_logging=google_cloud_logging
212
+ )
213
+
214
+ class MiddlewareLogger(BaseLogger):
215
+ def __init__(
216
+ self,
217
+ dir: str,
218
+ service_key: BaseTypes.OptionalString = None,
219
+ level = BaseEnums.LoggerLevel.INFO,
220
+ google_cloud_logging = None
221
+ ):
222
+ super().__init__(
223
+ dir=dir,
224
+ type=BaseEnums.LoggerType.MIDDLEWARE,
225
+ service_key=service_key,
226
+ client_key=None,
227
+ level=level,
228
+ google_cloud_logging=google_cloud_logging
229
+ )
230
+
231
+ class RepositoryLogger(BaseLogger):
232
+ def __init__(
233
+ self,
234
+ dir: str,
235
+ service_key: BaseTypes.OptionalString = None,
236
+ level: BaseEnums.LoggerLevel = BaseEnums.LoggerLevel.INFO,
237
+ google_cloud_logging: Optional[GoogleCloudLogging] = None
238
+ ):
239
+ super().__init__(
240
+ dir=dir,
241
+ type=BaseEnums.LoggerType.REPOSITORY,
242
+ service_key=service_key,
243
+ client_key=None,
244
+ level=level,
245
+ google_cloud_logging=google_cloud_logging
246
+ )
247
+
248
+ class ServiceLogger(BaseLogger):
249
+ def __init__(
250
+ self,
251
+ dir: str,
252
+ service_key: BaseTypes.OptionalString = None,
253
+ level: BaseEnums.LoggerLevel = BaseEnums.LoggerLevel.INFO,
254
+ google_cloud_logging: Optional[GoogleCloudLogging] = None
255
+ ):
256
+ super().__init__(
257
+ dir=dir,
258
+ type=BaseEnums.LoggerType.SERVICE,
259
+ service_key=service_key,
260
+ client_key=None,
261
+ level=level,
262
+ google_cloud_logging=google_cloud_logging
199
263
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.3.36
3
+ Version: 0.3.38
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maleo_foundation"
7
- version = "0.3.36"
7
+ version = "0.3.38"
8
8
  description = "Foundation package for Maleo"
9
9
  authors = [
10
10
  { name = "Agra Bima Yuda", email = "agra@nexmedis.com" }