maleo-foundation 0.1.4__py3-none-any.whl → 0.1.6__py3-none-any.whl
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.
- maleo_foundation/clients/utils/logger.py +49 -49
- maleo_foundation/managers/service.py +3 -0
- {maleo_foundation-0.1.4.dist-info → maleo_foundation-0.1.6.dist-info}/METADATA +1 -1
- {maleo_foundation-0.1.4.dist-info → maleo_foundation-0.1.6.dist-info}/RECORD +6 -6
- {maleo_foundation-0.1.4.dist-info → maleo_foundation-0.1.6.dist-info}/WHEEL +0 -0
- {maleo_foundation-0.1.4.dist-info → maleo_foundation-0.1.6.dist-info}/top_level.txt +0 -0
@@ -1,54 +1,54 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
from typing import Dict
|
2
|
+
from maleo_foundation.enums import BaseEnums
|
3
|
+
from maleo_foundation.types import BaseTypes
|
4
|
+
from maleo_foundation.utils.logger import BaseLogger
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
class ClientLoggerManager:
|
7
|
+
_loggers:Dict[type, BaseLogger] = {}
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
9
|
+
@classmethod
|
10
|
+
def initialize(
|
11
|
+
cls,
|
12
|
+
base_dir:str,
|
13
|
+
client_name:str,
|
14
|
+
service_name:BaseTypes.OptionalString = None,
|
15
|
+
level:BaseEnums.LoggerLevel = BaseEnums.LoggerLevel.INFO
|
16
|
+
) -> BaseLogger:
|
17
|
+
"""Initialize client logger if not already initialized."""
|
18
|
+
if cls not in cls._loggers:
|
19
|
+
cls._loggers[cls] = BaseLogger(
|
20
|
+
base_dir=base_dir,
|
21
|
+
type=BaseEnums.LoggerType.CLIENT,
|
22
|
+
service_name=service_name,
|
23
|
+
client_name=client_name,
|
24
|
+
level=level
|
25
|
+
)
|
26
|
+
return cls._loggers[cls]
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
@classmethod
|
29
|
+
def get(cls) -> BaseLogger:
|
30
|
+
"""Return client logger (if exist) or raise Runtime Error"""
|
31
|
+
if cls not in cls._loggers:
|
32
|
+
raise RuntimeError("Logger has not been initialized. Call 'initialize' first.")
|
33
|
+
return cls._loggers[cls]
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
35
|
+
class MaleoFoundationLoggerManager(ClientLoggerManager):
|
36
|
+
@classmethod
|
37
|
+
def initialize(
|
38
|
+
cls,
|
39
|
+
base_dir:str,
|
40
|
+
service_name:BaseTypes.OptionalString = None,
|
41
|
+
level:BaseEnums.LoggerLevel = BaseEnums.LoggerLevel.INFO
|
42
|
+
) -> BaseLogger:
|
43
|
+
"""Initialize MaleoFoundation's client logger if not already initialized."""
|
44
|
+
return super().initialize(
|
45
|
+
base_dir=base_dir,
|
46
|
+
client_name="MaleoFoundation",
|
47
|
+
service_name=service_name,
|
48
|
+
level=level
|
49
|
+
)
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
@classmethod
|
52
|
+
def get(cls) -> BaseLogger:
|
53
|
+
"""Return client logger (if exist) or raise Runtime Error"""
|
54
|
+
return super().get()
|
@@ -117,6 +117,9 @@ class MaleoClientManagers(BaseModel):
|
|
117
117
|
imaging:Optional[MaleoClientManager] = Field(None, description="MaleoImaging client manager")
|
118
118
|
mcu:Optional[MaleoClientManager] = Field(None, description="MaleoMCU client manager")
|
119
119
|
|
120
|
+
class Config:
|
121
|
+
arbitrary_types_allowed=True
|
122
|
+
|
120
123
|
class ClientManagers(BaseModel):
|
121
124
|
google:GoogleClientManagers = Field(..., description="Google client's managers")
|
122
125
|
http:Type[HTTPClientManager] = Field(..., description="HTTP client's manager")
|
@@ -16,7 +16,7 @@ maleo_foundation/clients/google/cloud/logging.py,sha256=s9T9bex0GeCPwIHrBRvilT23
|
|
16
16
|
maleo_foundation/clients/google/cloud/secret.py,sha256=1dua0V2FHesjltLdc1N4PF8xTXPzmcSA3sgwBzYNUtM,5853
|
17
17
|
maleo_foundation/clients/google/cloud/storage.py,sha256=t8hAZiQj_RFhJJXE8a20WP7spNKTEFw1RK1AqurL3T8,3848
|
18
18
|
maleo_foundation/clients/utils/__init__.py,sha256=hChEGABHH4tOFxPRcpxmlhkM9PgF18M7wXapH88hpu4,131
|
19
|
-
maleo_foundation/clients/utils/logger.py,sha256=
|
19
|
+
maleo_foundation/clients/utils/logger.py,sha256=FMnHKV4i6xR6e8XN7kCNwTf1jhSLdJUIO7teSm5g0D4,1829
|
20
20
|
maleo_foundation/db/__init__.py,sha256=fmvhCz4_siHfyKJujcUakKDKmuLxMhxn2w5tmfQwfcM,135
|
21
21
|
maleo_foundation/db/engine.py,sha256=hhYjCt5IEb864H2RNlUVS7GfMzuThHKRV260Bgkhn_o,3003
|
22
22
|
maleo_foundation/db/manager.py,sha256=nSstMJ9JBoEKTSLlz6MNf4Wuet8DLp2Pipfveg4kM1c,4663
|
@@ -30,7 +30,7 @@ maleo_foundation/expanded_types/service.py,sha256=q8jpKdbCbLWwH1UPQavKpVE14rC5rv
|
|
30
30
|
maleo_foundation/expanded_types/token.py,sha256=4fRTJw6W5MYq71NksNrWNi7qYHQ4_lQwfu9WxwrMipc,355
|
31
31
|
maleo_foundation/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
32
32
|
maleo_foundation/managers/db.py,sha256=rbB5W2rSxV2xcexh9j79U4ZKgAuA61t8ZD2IKppg22k,4867
|
33
|
-
maleo_foundation/managers/service.py,sha256=
|
33
|
+
maleo_foundation/managers/service.py,sha256=UVslS10rF0k-dWYHGdG8eZAXXq0GywZ24hnW46QghPo,13566
|
34
34
|
maleo_foundation/managers/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
35
|
maleo_foundation/managers/client/base.py,sha256=GytrN4WB0oa8Flg6VHJ4oSg7kaWQBjXQ8GTwC4VFleY,965
|
36
36
|
maleo_foundation/managers/client/http.py,sha256=dWFZlG1z4TERYBITReR5oSrlzvdhh2EtztVnsU8gCeA,2712
|
@@ -79,7 +79,7 @@ maleo_foundation/utils/logging.py,sha256=DuAaKQ1X7lB0y6udR-GF95BRKeluh0JoYN0K_jc
|
|
79
79
|
maleo_foundation/utils/query.py,sha256=ODQ3adOYQNj5E2cRW9ytbjBz56nEDcnfq8mQ6YZbCCM,4375
|
80
80
|
maleo_foundation/utils/formatter/__init__.py,sha256=iKf5YCbEdg1qKnFHyKqqcQbqAqEeRUf8mhI3v3dQoj8,78
|
81
81
|
maleo_foundation/utils/formatter/case.py,sha256=TmvvlfzGdC_omMTB5vAa40TZBxQ3hnr-SYeo0M52Rlg,1352
|
82
|
-
maleo_foundation-0.1.
|
83
|
-
maleo_foundation-0.1.
|
84
|
-
maleo_foundation-0.1.
|
85
|
-
maleo_foundation-0.1.
|
82
|
+
maleo_foundation-0.1.6.dist-info/METADATA,sha256=5KvAYHj2Ul78uSv0xYUeFo3gAvtsQSygfpeXMo4GALM,3189
|
83
|
+
maleo_foundation-0.1.6.dist-info/WHEEL,sha256=GHB6lJx2juba1wDgXDNlMTyM13ckjBMKf-OnwgKOCtA,91
|
84
|
+
maleo_foundation-0.1.6.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
|
85
|
+
maleo_foundation-0.1.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|