orionis 0.404.0__py3-none-any.whl → 0.406.0__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.
- orionis/console/base/command.py +57 -50
- orionis/console/base/contracts/command.py +68 -0
- orionis/console/dynamic/contracts/progress_bar.py +3 -3
- orionis/console/dynamic/progress_bar.py +8 -8
- orionis/console/output/console.py +8 -2
- orionis/console/output/contracts/console.py +1 -1
- orionis/container/container.py +2 -2
- orionis/container/context/scope.py +4 -1
- orionis/container/contracts/service_provider.py +2 -2
- orionis/container/entities/binding.py +31 -44
- orionis/container/enums/lifetimes.py +22 -1
- orionis/container/facades/facade.py +1 -2
- orionis/container/providers/service_provider.py +2 -2
- orionis/foundation/application.py +542 -248
- orionis/foundation/config/app/entities/app.py +107 -90
- orionis/foundation/config/auth/entities/auth.py +4 -33
- orionis/foundation/config/cache/entities/cache.py +18 -41
- orionis/foundation/config/cache/entities/file.py +8 -35
- orionis/foundation/config/cache/entities/stores.py +17 -38
- orionis/foundation/config/cors/entities/cors.py +41 -54
- orionis/foundation/config/database/entities/connections.py +40 -56
- orionis/foundation/config/database/entities/database.py +11 -38
- orionis/foundation/config/database/entities/mysql.py +48 -76
- orionis/foundation/config/database/entities/oracle.py +30 -57
- orionis/foundation/config/database/entities/pgsql.py +45 -61
- orionis/foundation/config/database/entities/sqlite.py +26 -53
- orionis/foundation/config/filesystems/entitites/aws.py +28 -49
- orionis/foundation/config/filesystems/entitites/disks.py +27 -47
- orionis/foundation/config/filesystems/entitites/filesystems.py +15 -37
- orionis/foundation/config/filesystems/entitites/local.py +9 -35
- orionis/foundation/config/filesystems/entitites/public.py +14 -41
- orionis/foundation/config/logging/entities/channels.py +56 -86
- orionis/foundation/config/logging/entities/chunked.py +18 -10
- orionis/foundation/config/logging/entities/daily.py +17 -9
- orionis/foundation/config/logging/entities/hourly.py +15 -7
- orionis/foundation/config/logging/entities/logging.py +12 -18
- orionis/foundation/config/logging/entities/monthly.py +16 -8
- orionis/foundation/config/logging/entities/stack.py +15 -7
- orionis/foundation/config/logging/entities/weekly.py +15 -7
- orionis/foundation/config/logging/validators/path.py +6 -0
- orionis/foundation/config/mail/entities/file.py +9 -36
- orionis/foundation/config/mail/entities/mail.py +22 -40
- orionis/foundation/config/mail/entities/mailers.py +29 -44
- orionis/foundation/config/mail/entities/smtp.py +47 -48
- orionis/foundation/config/queue/entities/brokers.py +19 -41
- orionis/foundation/config/queue/entities/database.py +24 -46
- orionis/foundation/config/queue/entities/queue.py +28 -40
- orionis/foundation/config/roots/paths.py +272 -468
- orionis/foundation/config/session/entities/session.py +23 -53
- orionis/foundation/config/startup.py +165 -135
- orionis/foundation/config/testing/entities/testing.py +137 -122
- orionis/foundation/config/testing/enums/__init__.py +6 -2
- orionis/foundation/config/testing/enums/drivers.py +16 -0
- orionis/foundation/config/testing/enums/verbosity.py +18 -0
- orionis/foundation/contracts/application.py +152 -362
- orionis/foundation/providers/console_provider.py +24 -2
- orionis/foundation/providers/dumper_provider.py +24 -2
- orionis/foundation/providers/logger_provider.py +24 -2
- orionis/foundation/providers/path_resolver_provider.py +25 -2
- orionis/foundation/providers/progress_bar_provider.py +24 -2
- orionis/foundation/providers/testing_provider.py +39 -0
- orionis/foundation/providers/workers_provider.py +24 -2
- orionis/metadata/framework.py +1 -1
- orionis/services/environment/helpers/functions.py +1 -2
- orionis/services/environment/key/__init__.py +0 -0
- orionis/services/environment/key/key_generator.py +37 -0
- orionis/services/log/handlers/filename.py +64 -0
- orionis/services/log/handlers/size_rotating.py +9 -40
- orionis/services/log/handlers/timed_rotating.py +9 -41
- orionis/services/log/log_service.py +9 -52
- orionis/support/entities/__init__.py +0 -0
- orionis/support/entities/base.py +104 -0
- orionis/support/facades/testing.py +15 -0
- orionis/support/facades/workers.py +1 -1
- orionis/test/cases/asynchronous.py +0 -11
- orionis/test/cases/synchronous.py +0 -9
- orionis/test/contracts/dumper.py +11 -4
- orionis/test/contracts/kernel.py +5 -110
- orionis/test/contracts/logs.py +27 -65
- orionis/test/contracts/printer.py +16 -128
- orionis/test/contracts/test_result.py +100 -0
- orionis/test/contracts/unit_test.py +87 -150
- orionis/test/core/unit_test.py +608 -554
- orionis/test/entities/result.py +22 -2
- orionis/test/enums/__init__.py +0 -2
- orionis/test/enums/status.py +14 -9
- orionis/test/exceptions/config.py +9 -1
- orionis/test/exceptions/failure.py +34 -11
- orionis/test/exceptions/persistence.py +10 -2
- orionis/test/exceptions/runtime.py +9 -1
- orionis/test/exceptions/value.py +13 -1
- orionis/test/kernel.py +87 -289
- orionis/test/output/dumper.py +82 -18
- orionis/test/output/printer.py +399 -156
- orionis/test/records/logs.py +203 -82
- orionis/test/validators/__init__.py +33 -0
- orionis/test/validators/base_path.py +45 -0
- orionis/test/validators/execution_mode.py +45 -0
- orionis/test/validators/fail_fast.py +37 -0
- orionis/test/validators/folder_path.py +34 -0
- orionis/test/validators/module_name.py +31 -0
- orionis/test/validators/name_pattern.py +40 -0
- orionis/test/validators/pattern.py +36 -0
- orionis/test/validators/persistent.py +42 -0
- orionis/test/validators/persistent_driver.py +43 -0
- orionis/test/validators/print_result.py +37 -0
- orionis/test/validators/tags.py +37 -0
- orionis/test/validators/throw_exception.py +39 -0
- orionis/test/validators/verbosity.py +37 -0
- orionis/test/validators/web_report.py +35 -0
- orionis/test/validators/workers.py +31 -0
- orionis/test/view/render.py +48 -54
- {orionis-0.404.0.dist-info → orionis-0.406.0.dist-info}/METADATA +1 -1
- {orionis-0.404.0.dist-info → orionis-0.406.0.dist-info}/RECORD +160 -108
- tests/container/__init__.py +0 -0
- tests/container/context/__init__.py +0 -0
- tests/container/context/test_manager.py +27 -0
- tests/container/context/test_scope.py +23 -0
- tests/container/entities/__init__.py +0 -0
- tests/container/entities/test_binding.py +133 -0
- tests/container/enums/__init__.py +0 -0
- tests/container/enums/test_lifetimes.py +63 -0
- tests/container/facades/__init__.py +0 -0
- tests/container/facades/test_facade.py +61 -0
- tests/container/mocks/__init__.py +0 -0
- tests/container/mocks/mock_complex_classes.py +482 -0
- tests/container/mocks/mock_simple_classes.py +32 -0
- tests/container/providers/__init__.py +0 -0
- tests/container/providers/test_providers.py +48 -0
- tests/container/resolver/__init__.py +0 -0
- tests/container/resolver/test_resolver.py +55 -0
- tests/container/test_container.py +254 -0
- tests/container/test_singleton.py +98 -0
- tests/container/test_thread_safety.py +217 -0
- tests/container/validators/__init__.py +0 -0
- tests/container/validators/test_implements.py +140 -0
- tests/container/validators/test_is_abstract_class.py +99 -0
- tests/container/validators/test_is_callable.py +73 -0
- tests/container/validators/test_is_concrete_class.py +97 -0
- tests/container/validators/test_is_instance.py +105 -0
- tests/container/validators/test_is_not_subclass.py +117 -0
- tests/container/validators/test_is_subclass.py +115 -0
- tests/container/validators/test_is_valid_alias.py +113 -0
- tests/container/validators/test_lifetime.py +75 -0
- tests/foundation/config/logging/test_foundation_config_logging_chunked.py +12 -34
- tests/foundation/config/logging/test_foundation_config_logging_daily.py +11 -11
- tests/foundation/config/logging/test_foundation_config_logging_hourly.py +7 -8
- tests/foundation/config/logging/test_foundation_config_logging_monthly.py +7 -10
- tests/foundation/config/logging/test_foundation_config_logging_stack.py +6 -11
- tests/foundation/config/logging/test_foundation_config_logging_weekly.py +6 -5
- tests/foundation/config/testing/test_foundation_config_testing.py +1 -1
- tests/metadata/test_metadata_framework.py +18 -18
- tests/testing/test_testing_result.py +117 -117
- tests/testing/test_testing_unit.py +209 -209
- orionis/foundation/config/base.py +0 -112
- orionis/test/arguments/parser.py +0 -187
- orionis/test/contracts/parser.py +0 -43
- orionis/test/entities/arguments.py +0 -38
- orionis/test/enums/execution_mode.py +0 -16
- /orionis/{test/arguments → console/base/contracts}/__init__.py +0 -0
- /orionis/foundation/config/testing/enums/{test_mode.py → mode.py} +0 -0
- {orionis-0.404.0.dist-info → orionis-0.406.0.dist-info}/WHEEL +0 -0
- {orionis-0.404.0.dist-info → orionis-0.406.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.404.0.dist-info → orionis-0.406.0.dist-info}/top_level.txt +0 -0
- {orionis-0.404.0.dist-info → orionis-0.406.0.dist-info}/zip-safe +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from orionis.
|
|
2
|
+
from orionis.support.entities.base import BaseEntity
|
|
3
3
|
from orionis.foundation.config.logging.entities.monthly import Monthly
|
|
4
4
|
from orionis.foundation.config.logging.entities.chunked import Chunked
|
|
5
5
|
from orionis.foundation.config.logging.entities.daily import Daily
|
|
@@ -9,56 +9,56 @@ from orionis.foundation.config.logging.entities.weekly import Weekly
|
|
|
9
9
|
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
10
10
|
|
|
11
11
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
12
|
-
class Channels(
|
|
12
|
+
class Channels(BaseEntity):
|
|
13
13
|
"""
|
|
14
14
|
Represents the different logging channels available.
|
|
15
15
|
"""
|
|
16
16
|
|
|
17
17
|
stack: Stack | dict = field(
|
|
18
18
|
default_factory = lambda: Stack(),
|
|
19
|
-
metadata={
|
|
19
|
+
metadata = {
|
|
20
20
|
"description": "Configuration for stack log channel.",
|
|
21
|
-
"default":
|
|
21
|
+
"default": Stack().toDict()
|
|
22
22
|
}
|
|
23
23
|
)
|
|
24
24
|
|
|
25
25
|
hourly: Hourly | dict = field(
|
|
26
26
|
default_factory = lambda: Hourly(),
|
|
27
|
-
metadata={
|
|
27
|
+
metadata = {
|
|
28
28
|
"description": "Configuration for hourly log rotation.",
|
|
29
|
-
"default":
|
|
29
|
+
"default": Hourly().toDict()
|
|
30
30
|
}
|
|
31
31
|
)
|
|
32
32
|
|
|
33
33
|
daily: Daily | dict = field(
|
|
34
34
|
default_factory = lambda: Daily(),
|
|
35
|
-
metadata={
|
|
35
|
+
metadata = {
|
|
36
36
|
"description": "Configuration for daily log rotation.",
|
|
37
|
-
"default":
|
|
37
|
+
"default": Daily().toDict()
|
|
38
38
|
}
|
|
39
39
|
)
|
|
40
40
|
|
|
41
41
|
weekly: Weekly | dict = field(
|
|
42
42
|
default_factory = lambda: Weekly(),
|
|
43
|
-
metadata={
|
|
43
|
+
metadata = {
|
|
44
44
|
"description": "Configuration for weekly log rotation.",
|
|
45
|
-
"default":
|
|
45
|
+
"default": Weekly().toDict()
|
|
46
46
|
}
|
|
47
47
|
)
|
|
48
48
|
|
|
49
49
|
monthly: Monthly | dict= field(
|
|
50
50
|
default_factory = lambda: Monthly(),
|
|
51
|
-
metadata={
|
|
51
|
+
metadata = {
|
|
52
52
|
"description": "Configuration for monthly log rotation.",
|
|
53
|
-
"default":
|
|
53
|
+
"default": Monthly().toDict()
|
|
54
54
|
}
|
|
55
55
|
)
|
|
56
56
|
|
|
57
57
|
chunked: Chunked | dict = field(
|
|
58
58
|
default_factory = lambda: Chunked(),
|
|
59
|
-
metadata={
|
|
59
|
+
metadata = {
|
|
60
60
|
"description": "Configuration for chunked log file storage.",
|
|
61
|
-
"default":
|
|
61
|
+
"default": Chunked().toDict()
|
|
62
62
|
}
|
|
63
63
|
)
|
|
64
64
|
|
|
@@ -76,80 +76,50 @@ class Channels(BaseConfigEntity):
|
|
|
76
76
|
OrionisIntegrityException: If any of the properties are not instances of their expected classes.
|
|
77
77
|
"""
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
)
|
|
87
|
-
else:
|
|
88
|
-
raise OrionisIntegrityException(
|
|
89
|
-
"The 'stack' property must be an instance of Stack or a dictionary."
|
|
90
|
-
)
|
|
79
|
+
# Validate `stack` attribute
|
|
80
|
+
if not isinstance(self.stack, (Stack, dict)):
|
|
81
|
+
raise OrionisIntegrityException(
|
|
82
|
+
"The 'stack' property must be an instance of Stack or a dictionary."
|
|
83
|
+
)
|
|
84
|
+
if isinstance(self.stack, dict):
|
|
85
|
+
self.stack = Stack(**self.stack)
|
|
91
86
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
)
|
|
100
|
-
else:
|
|
101
|
-
raise OrionisIntegrityException(
|
|
102
|
-
"The 'hourly' property must be an instance of Hourly or a dictionary."
|
|
103
|
-
)
|
|
87
|
+
# Validate `hourly` attribute
|
|
88
|
+
if not isinstance(self.hourly, (Hourly, dict)):
|
|
89
|
+
raise OrionisIntegrityException(
|
|
90
|
+
"The 'hourly' property must be an instance of Hourly or a dictionary."
|
|
91
|
+
)
|
|
92
|
+
if isinstance(self.hourly, dict):
|
|
93
|
+
self.hourly = Hourly(**self.hourly)
|
|
104
94
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
)
|
|
113
|
-
else:
|
|
114
|
-
raise OrionisIntegrityException(
|
|
115
|
-
"The 'daily' property must be an instance of Daily or a dictionary."
|
|
116
|
-
)
|
|
95
|
+
# Validate `daily` attribute
|
|
96
|
+
if not isinstance(self.daily, (Daily, dict)):
|
|
97
|
+
raise OrionisIntegrityException(
|
|
98
|
+
"The 'daily' property must be an instance of Daily or a dictionary."
|
|
99
|
+
)
|
|
100
|
+
if isinstance(self.daily, dict):
|
|
101
|
+
self.daily = Daily(**self.daily)
|
|
117
102
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
)
|
|
126
|
-
else:
|
|
127
|
-
raise OrionisIntegrityException(
|
|
128
|
-
"The 'weekly' property must be an instance of Weekly or a dictionary."
|
|
129
|
-
)
|
|
103
|
+
# Validate `weekly` attribute
|
|
104
|
+
if not isinstance(self.weekly, (Weekly, dict)):
|
|
105
|
+
raise OrionisIntegrityException(
|
|
106
|
+
"The 'weekly' property must be an instance of Weekly or a dictionary."
|
|
107
|
+
)
|
|
108
|
+
if isinstance(self.weekly, dict):
|
|
109
|
+
self.weekly = Weekly(**self.weekly)
|
|
130
110
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
)
|
|
139
|
-
else:
|
|
140
|
-
raise OrionisIntegrityException(
|
|
141
|
-
"The 'monthly' property must be an instance of Monthly or a dictionary."
|
|
142
|
-
)
|
|
111
|
+
# Validate `monthly` attribute
|
|
112
|
+
if not isinstance(self.monthly, (Monthly, dict)):
|
|
113
|
+
raise OrionisIntegrityException(
|
|
114
|
+
"The 'monthly' property must be an instance of Monthly or a dictionary."
|
|
115
|
+
)
|
|
116
|
+
if isinstance(self.monthly, dict):
|
|
117
|
+
self.monthly = Monthly(**self.monthly)
|
|
143
118
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
)
|
|
152
|
-
else:
|
|
153
|
-
raise OrionisIntegrityException(
|
|
154
|
-
"The 'chunked' property must be an instance of Chunked or a dictionary."
|
|
155
|
-
)
|
|
119
|
+
# Validate `chunked` attribute
|
|
120
|
+
if not isinstance(self.chunked, (Chunked, dict)):
|
|
121
|
+
raise OrionisIntegrityException(
|
|
122
|
+
"The 'chunked' property must be an instance of Chunked or a dictionary."
|
|
123
|
+
)
|
|
124
|
+
if isinstance(self.chunked, dict):
|
|
125
|
+
self.chunked = Chunked(**self.chunked)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from orionis.
|
|
2
|
+
from orionis.support.entities.base import BaseEntity
|
|
3
3
|
from orionis.foundation.config.logging.validators import IsValidPath, IsValidLevel
|
|
4
4
|
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
5
5
|
from orionis.foundation.config.logging.enums import Level
|
|
6
6
|
|
|
7
7
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
8
|
-
class Chunked(
|
|
8
|
+
class Chunked(BaseEntity):
|
|
9
9
|
"""
|
|
10
10
|
Configuration for chunked log file rotation.
|
|
11
11
|
|
|
@@ -26,34 +26,34 @@ class Chunked(BaseConfigEntity):
|
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
path: str = field(
|
|
29
|
-
default = 'storage/log/
|
|
29
|
+
default = 'storage/log/chunked.log',
|
|
30
30
|
metadata = {
|
|
31
31
|
"description": "The file path where the log is stored.",
|
|
32
|
-
"default": "storage/log/
|
|
32
|
+
"default": "storage/log/chunked.log"
|
|
33
33
|
},
|
|
34
34
|
)
|
|
35
35
|
|
|
36
36
|
level: int | str | Level = field(
|
|
37
|
-
default = Level.INFO,
|
|
37
|
+
default = Level.INFO.value,
|
|
38
38
|
metadata = {
|
|
39
39
|
"description": "The logging level (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL).",
|
|
40
|
-
"default": Level.INFO
|
|
40
|
+
"default": Level.INFO.value
|
|
41
41
|
},
|
|
42
42
|
)
|
|
43
43
|
|
|
44
44
|
mb_size: int = field(
|
|
45
45
|
default = 10,
|
|
46
|
-
metadata={
|
|
46
|
+
metadata = {
|
|
47
47
|
"description": "Maximum size (in MB) of a log file before chunking.",
|
|
48
|
-
"default": 10
|
|
48
|
+
"default": 10
|
|
49
49
|
},
|
|
50
50
|
)
|
|
51
51
|
|
|
52
52
|
files: int = field(
|
|
53
53
|
default = 5,
|
|
54
|
-
metadata={
|
|
54
|
+
metadata = {
|
|
55
55
|
"description": "Maximum number of log files to retain.",
|
|
56
|
-
"default": 5
|
|
56
|
+
"default": 5
|
|
57
57
|
},
|
|
58
58
|
)
|
|
59
59
|
|
|
@@ -78,6 +78,14 @@ class Chunked(BaseConfigEntity):
|
|
|
78
78
|
# Validate 'level' using the IsValidLevel validator
|
|
79
79
|
IsValidLevel(self.level)
|
|
80
80
|
|
|
81
|
+
# Assign the level value.
|
|
82
|
+
if isinstance(self.level, Level):
|
|
83
|
+
self.level = self.level.value
|
|
84
|
+
elif isinstance(self.level, str):
|
|
85
|
+
self.level = Level[self.level.strip().upper()].value
|
|
86
|
+
elif isinstance(self.level, int):
|
|
87
|
+
self.level = self.level
|
|
88
|
+
|
|
81
89
|
# Validate 'mb_size'
|
|
82
90
|
if not isinstance(self.mb_size, int):
|
|
83
91
|
raise OrionisIntegrityException(
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
2
|
from datetime import datetime, time
|
|
3
|
-
from orionis.
|
|
3
|
+
from orionis.support.entities.base import BaseEntity
|
|
4
4
|
from orionis.foundation.config.logging.validators import IsValidPath, IsValidLevel
|
|
5
5
|
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
6
6
|
from orionis.foundation.config.logging.enums import Level
|
|
7
7
|
|
|
8
8
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
9
|
-
class Daily(
|
|
9
|
+
class Daily(BaseEntity):
|
|
10
10
|
"""
|
|
11
11
|
Represents the configuration for daily log file rotation.
|
|
12
12
|
|
|
@@ -18,18 +18,18 @@ class Daily(BaseConfigEntity):
|
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
20
|
path: str = field(
|
|
21
|
-
default = 'storage/log/
|
|
21
|
+
default = 'storage/log/daily.log',
|
|
22
22
|
metadata = {
|
|
23
23
|
"description": "The file path where the log is stored.",
|
|
24
|
-
"default": "storage/log/
|
|
24
|
+
"default": "storage/log/daily.log"
|
|
25
25
|
},
|
|
26
26
|
)
|
|
27
27
|
|
|
28
28
|
level: int | str | Level = field(
|
|
29
|
-
default = Level.INFO,
|
|
29
|
+
default = Level.INFO.value,
|
|
30
30
|
metadata = {
|
|
31
31
|
"description": "The logging level (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL).",
|
|
32
|
-
"default": Level.INFO
|
|
32
|
+
"default": Level.INFO.value
|
|
33
33
|
},
|
|
34
34
|
)
|
|
35
35
|
|
|
@@ -37,15 +37,15 @@ class Daily(BaseConfigEntity):
|
|
|
37
37
|
default = 7,
|
|
38
38
|
metadata = {
|
|
39
39
|
"description": "The number of days to retain log files before deletion.",
|
|
40
|
-
"default": 7
|
|
40
|
+
"default": 7
|
|
41
41
|
},
|
|
42
42
|
)
|
|
43
43
|
|
|
44
44
|
at: time | str = field(
|
|
45
45
|
default = time(0, 0).strftime("%H:%M"),
|
|
46
|
-
metadata={
|
|
46
|
+
metadata = {
|
|
47
47
|
"description": "The time of day when the log rotation should occur.",
|
|
48
|
-
"default": time(0, 0).strftime("%H:%M")
|
|
48
|
+
"default": time(0, 0).strftime("%H:%M")
|
|
49
49
|
},
|
|
50
50
|
)
|
|
51
51
|
|
|
@@ -63,6 +63,14 @@ class Daily(BaseConfigEntity):
|
|
|
63
63
|
# Validate 'level' using the IsValidLevel validator
|
|
64
64
|
IsValidLevel(self.level)
|
|
65
65
|
|
|
66
|
+
# Assign the level value.
|
|
67
|
+
if isinstance(self.level, Level):
|
|
68
|
+
self.level = self.level.value
|
|
69
|
+
elif isinstance(self.level, str):
|
|
70
|
+
self.level = Level[self.level.strip().upper()].value
|
|
71
|
+
elif isinstance(self.level, int):
|
|
72
|
+
self.level = self.level
|
|
73
|
+
|
|
66
74
|
# Validate 'retention_days'
|
|
67
75
|
if not isinstance(self.retention_days, int):
|
|
68
76
|
raise OrionisIntegrityException(
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from orionis.
|
|
2
|
+
from orionis.support.entities.base import BaseEntity
|
|
3
3
|
from orionis.foundation.config.logging.validators import IsValidLevel, IsValidPath
|
|
4
4
|
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
5
5
|
from orionis.foundation.config.logging.enums import Level
|
|
6
6
|
|
|
7
7
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
8
|
-
class Hourly(
|
|
8
|
+
class Hourly(BaseEntity):
|
|
9
9
|
"""
|
|
10
10
|
Represents the configuration for hourly log file management.
|
|
11
11
|
|
|
@@ -16,18 +16,18 @@ class Hourly(BaseConfigEntity):
|
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
path: str = field(
|
|
19
|
-
default = 'storage/log/
|
|
19
|
+
default = 'storage/log/hourly.log',
|
|
20
20
|
metadata = {
|
|
21
21
|
"description": "The file path where the log is stored.",
|
|
22
|
-
"default": "storage/log/
|
|
22
|
+
"default": "storage/log/hourly.log"
|
|
23
23
|
},
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
level: int | str | Level = field(
|
|
27
|
-
default = Level.INFO,
|
|
27
|
+
default = Level.INFO.value,
|
|
28
28
|
metadata = {
|
|
29
29
|
"description": "The logging level (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL).",
|
|
30
|
-
"default": Level.INFO
|
|
30
|
+
"default": Level.INFO.value
|
|
31
31
|
},
|
|
32
32
|
)
|
|
33
33
|
|
|
@@ -35,7 +35,7 @@ class Hourly(BaseConfigEntity):
|
|
|
35
35
|
default = 24,
|
|
36
36
|
metadata = {
|
|
37
37
|
"description": "The number of hours to retain log files before deletion.",
|
|
38
|
-
"default": 24
|
|
38
|
+
"default": 24
|
|
39
39
|
},
|
|
40
40
|
)
|
|
41
41
|
|
|
@@ -56,6 +56,14 @@ class Hourly(BaseConfigEntity):
|
|
|
56
56
|
# Validate 'level' using the IsValidLevel validator
|
|
57
57
|
IsValidLevel(self.level)
|
|
58
58
|
|
|
59
|
+
# Assign the level value.
|
|
60
|
+
if isinstance(self.level, Level):
|
|
61
|
+
self.level = self.level.value
|
|
62
|
+
elif isinstance(self.level, str):
|
|
63
|
+
self.level = Level[self.level.strip().upper()].value
|
|
64
|
+
elif isinstance(self.level, int):
|
|
65
|
+
self.level = self.level
|
|
66
|
+
|
|
59
67
|
# Validate 'retention_hours'
|
|
60
68
|
if not isinstance(self.retention_hours, int) or self.retention_hours < 0:
|
|
61
69
|
raise OrionisIntegrityException(
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from dataclasses import dataclass, field, fields
|
|
2
|
-
from orionis.
|
|
2
|
+
from orionis.support.entities.base import BaseEntity
|
|
3
3
|
from orionis.foundation.config.logging.entities.channels import Channels
|
|
4
4
|
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
5
5
|
|
|
6
6
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
7
|
-
class Logging(
|
|
7
|
+
class Logging(BaseEntity):
|
|
8
8
|
"""
|
|
9
9
|
Represents the logging system configuration.
|
|
10
10
|
|
|
@@ -16,8 +16,8 @@ class Logging(BaseConfigEntity):
|
|
|
16
16
|
A collection of available logging channels.
|
|
17
17
|
"""
|
|
18
18
|
default: str = field(
|
|
19
|
-
default="stack",
|
|
20
|
-
metadata={
|
|
19
|
+
default = "stack",
|
|
20
|
+
metadata = {
|
|
21
21
|
"description": "The default logging channel to use.",
|
|
22
22
|
"default": "stack"
|
|
23
23
|
}
|
|
@@ -25,9 +25,9 @@ class Logging(BaseConfigEntity):
|
|
|
25
25
|
|
|
26
26
|
channels: Channels | dict = field(
|
|
27
27
|
default_factory = lambda: Channels(),
|
|
28
|
-
metadata={
|
|
28
|
+
metadata = {
|
|
29
29
|
"description": "A collection of available logging channels.",
|
|
30
|
-
"default":
|
|
30
|
+
"default": Channels().toDict()
|
|
31
31
|
}
|
|
32
32
|
)
|
|
33
33
|
|
|
@@ -58,15 +58,9 @@ class Logging(BaseConfigEntity):
|
|
|
58
58
|
f"The 'default' property must be a string and match one of the available options ({options})."
|
|
59
59
|
)
|
|
60
60
|
|
|
61
|
-
if not isinstance(self.channels, Channels):
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
f"Invalid channels configuration: {e}"
|
|
68
|
-
)
|
|
69
|
-
else:
|
|
70
|
-
raise OrionisIntegrityException(
|
|
71
|
-
"The 'channels' property must be an instance of Channels or a dictionary."
|
|
72
|
-
)
|
|
61
|
+
if not isinstance(self.channels, (Channels, dict)):
|
|
62
|
+
raise OrionisIntegrityException(
|
|
63
|
+
"The 'channels' property must be an instance of Channels or a dictionary."
|
|
64
|
+
)
|
|
65
|
+
if isinstance(self.channels, dict):
|
|
66
|
+
self.channels = Channels(**self.channels)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from orionis.
|
|
2
|
+
from orionis.support.entities.base import BaseEntity
|
|
3
3
|
from orionis.foundation.config.logging.validators import IsValidPath, IsValidLevel
|
|
4
4
|
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
5
5
|
from orionis.foundation.config.logging.enums import Level
|
|
6
6
|
|
|
7
7
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
8
|
-
class Monthly(
|
|
8
|
+
class Monthly(BaseEntity):
|
|
9
9
|
"""
|
|
10
10
|
Configuration entity for monthly log file management.
|
|
11
11
|
|
|
@@ -16,26 +16,26 @@ class Monthly(BaseConfigEntity):
|
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
path: str = field(
|
|
19
|
-
default = 'storage/log/
|
|
19
|
+
default = 'storage/log/monthly.log',
|
|
20
20
|
metadata = {
|
|
21
21
|
"description": "The file path where the log is stored.",
|
|
22
|
-
"default": "storage/log/
|
|
22
|
+
"default": "storage/log/monthly.log"
|
|
23
23
|
},
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
level: int | str | Level = field(
|
|
27
|
-
default = Level.INFO,
|
|
27
|
+
default = Level.INFO.value,
|
|
28
28
|
metadata = {
|
|
29
29
|
"description": "The logging level (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL).",
|
|
30
|
-
"default": Level.INFO
|
|
30
|
+
"default": Level.INFO.value
|
|
31
31
|
},
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
retention_months: int = field(
|
|
35
35
|
default = 4,
|
|
36
|
-
metadata={
|
|
36
|
+
metadata = {
|
|
37
37
|
"description": "The number of months to retain log files before deletion.",
|
|
38
|
-
"default": 4
|
|
38
|
+
"default": 4
|
|
39
39
|
},
|
|
40
40
|
)
|
|
41
41
|
|
|
@@ -55,6 +55,14 @@ class Monthly(BaseConfigEntity):
|
|
|
55
55
|
# Validate 'level' using the IsValidLevel validator
|
|
56
56
|
IsValidLevel(self.level)
|
|
57
57
|
|
|
58
|
+
# Assign the level value.
|
|
59
|
+
if isinstance(self.level, Level):
|
|
60
|
+
self.level = self.level.value
|
|
61
|
+
elif isinstance(self.level, str):
|
|
62
|
+
self.level = Level[self.level.strip().upper()].value
|
|
63
|
+
elif isinstance(self.level, int):
|
|
64
|
+
self.level = self.level
|
|
65
|
+
|
|
58
66
|
# Validate 'retention_months'
|
|
59
67
|
if not isinstance(self.retention_months, int):
|
|
60
68
|
raise OrionisIntegrityException(
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from orionis.
|
|
2
|
+
from orionis.support.entities.base import BaseEntity
|
|
3
3
|
from orionis.foundation.config.logging.validators import IsValidLevel, IsValidPath
|
|
4
4
|
from orionis.foundation.config.logging.enums import Level
|
|
5
5
|
|
|
6
6
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
7
|
-
class Stack(
|
|
7
|
+
class Stack(BaseEntity):
|
|
8
8
|
"""
|
|
9
9
|
Represents the configuration for a logging stack, including the log file path and logging level.
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
12
|
path: str = field(
|
|
13
|
-
default = 'storage/log/
|
|
13
|
+
default = 'storage/log/stack.log',
|
|
14
14
|
metadata = {
|
|
15
15
|
"description": "The file path where the log is stored.",
|
|
16
|
-
"default": "storage/log/
|
|
16
|
+
"default": "storage/log/stack.log"
|
|
17
17
|
},
|
|
18
18
|
)
|
|
19
19
|
|
|
20
20
|
level: int | str | Level = field(
|
|
21
|
-
default = Level.INFO,
|
|
21
|
+
default = Level.INFO.value,
|
|
22
22
|
metadata = {
|
|
23
23
|
"description": "The logging level (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL).",
|
|
24
|
-
"default": Level.INFO
|
|
24
|
+
"default": Level.INFO.value
|
|
25
25
|
},
|
|
26
26
|
)
|
|
27
27
|
|
|
@@ -37,4 +37,12 @@ class Stack(BaseConfigEntity):
|
|
|
37
37
|
IsValidPath(self.path)
|
|
38
38
|
|
|
39
39
|
# Validate 'level' using the IsValidLevel validator
|
|
40
|
-
IsValidLevel(self.level)
|
|
40
|
+
IsValidLevel(self.level)
|
|
41
|
+
|
|
42
|
+
# Assign the level value.
|
|
43
|
+
if isinstance(self.level, Level):
|
|
44
|
+
self.level = self.level.value
|
|
45
|
+
elif isinstance(self.level, str):
|
|
46
|
+
self.level = Level[self.level.strip().upper()].value
|
|
47
|
+
elif isinstance(self.level, int):
|
|
48
|
+
self.level = self.level
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from orionis.
|
|
2
|
+
from orionis.support.entities.base import BaseEntity
|
|
3
3
|
from orionis.foundation.config.logging.validators import IsValidPath, IsValidLevel
|
|
4
4
|
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
5
5
|
from orionis.foundation.config.logging.enums import Level
|
|
6
6
|
|
|
7
7
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
8
|
-
class Weekly(
|
|
8
|
+
class Weekly(BaseEntity):
|
|
9
9
|
"""
|
|
10
10
|
Configuration entity for weekly log file management.
|
|
11
11
|
|
|
@@ -16,18 +16,18 @@ class Weekly(BaseConfigEntity):
|
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
path: str = field(
|
|
19
|
-
default = 'storage/log/
|
|
19
|
+
default = 'storage/log/weekly.log',
|
|
20
20
|
metadata = {
|
|
21
21
|
"description": "The file path where the log is stored.",
|
|
22
|
-
"default": "storage/log/
|
|
22
|
+
"default": "storage/log/weekly.log"
|
|
23
23
|
},
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
level: int | str | Level = field(
|
|
27
|
-
default = Level.INFO,
|
|
27
|
+
default = Level.INFO.value,
|
|
28
28
|
metadata = {
|
|
29
29
|
"description": "The logging level (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL).",
|
|
30
|
-
"default": Level.INFO
|
|
30
|
+
"default": Level.INFO.value
|
|
31
31
|
},
|
|
32
32
|
)
|
|
33
33
|
|
|
@@ -35,7 +35,7 @@ class Weekly(BaseConfigEntity):
|
|
|
35
35
|
default = 4,
|
|
36
36
|
metadata = {
|
|
37
37
|
"description": "The number of weeks to retain log files before deletion.",
|
|
38
|
-
"default": 4
|
|
38
|
+
"default": 4
|
|
39
39
|
},
|
|
40
40
|
)
|
|
41
41
|
|
|
@@ -57,6 +57,14 @@ class Weekly(BaseConfigEntity):
|
|
|
57
57
|
# Validate 'level' using the IsValidLevel validator
|
|
58
58
|
IsValidLevel(self.level)
|
|
59
59
|
|
|
60
|
+
# Assign the level value.
|
|
61
|
+
if isinstance(self.level, Level):
|
|
62
|
+
self.level = self.level.value
|
|
63
|
+
elif isinstance(self.level, str):
|
|
64
|
+
self.level = Level[self.level.strip().upper()].value
|
|
65
|
+
elif isinstance(self.level, int):
|
|
66
|
+
self.level = self.level
|
|
67
|
+
|
|
60
68
|
# Validate 'retention_weeks'
|
|
61
69
|
if not isinstance(self.retention_weeks, int):
|
|
62
70
|
raise OrionisIntegrityException(
|
|
@@ -18,6 +18,8 @@ class __IsValidPath:
|
|
|
18
18
|
def __call__(self, value: Any) -> None:
|
|
19
19
|
"""
|
|
20
20
|
Validates that the provided value is a non-empty string representing a file path.
|
|
21
|
+
This method checks if the value is a string and not empty. It also ensures that the string ends with '.log',
|
|
22
|
+
indicating that it is a log file path.
|
|
21
23
|
|
|
22
24
|
Args:
|
|
23
25
|
value (Any): The value to validate as a file path.
|
|
@@ -29,6 +31,10 @@ class __IsValidPath:
|
|
|
29
31
|
raise OrionisIntegrityException(
|
|
30
32
|
f"File cache configuration error: 'path' must be a non-empty string, got {repr(value)}."
|
|
31
33
|
)
|
|
34
|
+
if not value.endswith('.log'):
|
|
35
|
+
raise OrionisIntegrityException(
|
|
36
|
+
f"File cache configuration error: 'path' must end with '.log', got {repr(value)}."
|
|
37
|
+
)
|
|
32
38
|
|
|
33
39
|
# Exported singleton instance
|
|
34
40
|
IsValidPath = __IsValidPath()
|