orionis 0.77.0__tar.gz → 0.78.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 (168) hide show
  1. {orionis-0.77.0/orionis.egg-info → orionis-0.78.0}/PKG-INFO +1 -1
  2. {orionis-0.77.0 → orionis-0.78.0}/orionis/framework.py +1 -1
  3. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/config/logging.py +74 -18
  4. orionis-0.78.0/orionis/luminate/services/log/log_service.py +251 -0
  5. {orionis-0.77.0 → orionis-0.78.0/orionis.egg-info}/PKG-INFO +1 -1
  6. orionis-0.77.0/orionis/luminate/services/log/log_service.py +0 -159
  7. {orionis-0.77.0 → orionis-0.78.0}/LICENCE +0 -0
  8. {orionis-0.77.0 → orionis-0.78.0}/MANIFEST.in +0 -0
  9. {orionis-0.77.0 → orionis-0.78.0}/README.md +0 -0
  10. {orionis-0.77.0 → orionis-0.78.0}/orionis/__init__.py +0 -0
  11. {orionis-0.77.0 → orionis-0.78.0}/orionis/cli_manager.py +0 -0
  12. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/__init__.py +0 -0
  13. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/bootstrap/i_command_bootstrapper.py +0 -0
  14. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/bootstrap/i_config_bootstrapper.py +0 -0
  15. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/bootstrap/i_environment_bootstrapper.py +0 -0
  16. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/config/__init__.py +0 -0
  17. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/config/i_config.py +0 -0
  18. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/console/__init__.py +0 -0
  19. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/console/base/__init__.py +0 -0
  20. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/console/base/i_command.py +0 -0
  21. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/console/i_command_filter.py +0 -0
  22. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/console/i_kernel.py +0 -0
  23. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/console/i_parser.py +0 -0
  24. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/console/i_task_manager.py +0 -0
  25. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/console/output/__init__.py +0 -0
  26. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/console/output/i_console.py +0 -0
  27. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/console/output/i_executor.py +0 -0
  28. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/console/output/i_progress_bar.py +0 -0
  29. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/console/tasks/__init__.py +0 -0
  30. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/console/tasks/i_schedule.py +0 -0
  31. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/container/i_container.py +0 -0
  32. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/container/i_types.py +0 -0
  33. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/facades/__init__.py +0 -0
  34. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/facades/config/__init__.py +0 -0
  35. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/facades/config/i_config_facade.py +0 -0
  36. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/facades/environment/__init__.py +0 -0
  37. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/facades/environment/i_environment_facade.py +0 -0
  38. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/facades/files/__init__.py +0 -0
  39. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/facades/files/i_path_facade.py +0 -0
  40. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/facades/log/__init__.py +0 -0
  41. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/facades/log/i_log_facade.py +0 -0
  42. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/facades/tests/__init__.py +0 -0
  43. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/facades/tests/i_tests_facade.py +0 -0
  44. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/installer/__init__.py +0 -0
  45. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/installer/i_installer_manager.py +0 -0
  46. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/installer/i_installer_output.py +0 -0
  47. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/installer/i_installer_setup.py +0 -0
  48. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/providers/__init__.py +0 -0
  49. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/providers/i_service_provider.py +0 -0
  50. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/services/__init__.py +0 -0
  51. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/services/config/__init__.py +0 -0
  52. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/services/config/i_config_service.py +0 -0
  53. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/services/environment/__init__.py +0 -0
  54. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/services/environment/i_environment_service.py +0 -0
  55. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/services/files/__init__.py +0 -0
  56. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/services/files/i_path_resolver_service.py +0 -0
  57. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/services/log/__init__.py +0 -0
  58. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/services/log/i_log_service.py +0 -0
  59. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/support/i_exception_to_dict.py +0 -0
  60. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/support/i_reflection.py +0 -0
  61. {orionis-0.77.0 → orionis-0.78.0}/orionis/contracts/support/i_std.py +0 -0
  62. {orionis-0.77.0 → orionis-0.78.0}/orionis/installer/__init__.py +0 -0
  63. {orionis-0.77.0 → orionis-0.78.0}/orionis/installer/installer_manager.py +0 -0
  64. {orionis-0.77.0 → orionis-0.78.0}/orionis/installer/installer_output.py +0 -0
  65. {orionis-0.77.0 → orionis-0.78.0}/orionis/installer/installer_setup.py +0 -0
  66. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/__init__.py +0 -0
  67. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/app.py +0 -0
  68. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/app_context.py +0 -0
  69. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/bootstrap/__init__.py +0 -0
  70. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/bootstrap/command_bootstrapper.py +0 -0
  71. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/bootstrap/config_bootstrapper.py +0 -0
  72. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/bootstrap/environment_bootstrapper.py +0 -0
  73. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/bootstrap/exception_bootstrapper.py +0 -0
  74. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/bootstrap/service_providers_bootstrapper.py +0 -0
  75. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/config/__init__.py +0 -0
  76. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/config/app.py +0 -0
  77. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/config/auth.py +0 -0
  78. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/config/cache.py +0 -0
  79. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/config/cors.py +0 -0
  80. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/config/database.py +0 -0
  81. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/config/filesystems.py +0 -0
  82. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/config/mail.py +0 -0
  83. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/config/queue.py +0 -0
  84. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/config/session.py +0 -0
  85. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/__init__.py +0 -0
  86. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/base/__init__.py +0 -0
  87. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/base/command.py +0 -0
  88. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/command_filter.py +0 -0
  89. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/commands/__init__.py +0 -0
  90. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/commands/cache_clear.py +0 -0
  91. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/commands/help.py +0 -0
  92. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/commands/schedule_work.py +0 -0
  93. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/commands/tests.py +0 -0
  94. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/commands/version.py +0 -0
  95. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/exceptions/__init__.py +0 -0
  96. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/exceptions/cli_exception.py +0 -0
  97. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/kernel.py +0 -0
  98. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/output/__init__.py +0 -0
  99. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/output/console.py +0 -0
  100. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/output/executor.py +0 -0
  101. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/output/progress_bar.py +0 -0
  102. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/output/styles.py +0 -0
  103. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/parser.py +0 -0
  104. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/runner.py +0 -0
  105. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/tasks/__init__.py +0 -0
  106. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/console/tasks/scheduler.py +0 -0
  107. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/container/container.py +0 -0
  108. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/container/exception.py +0 -0
  109. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/container/types.py +0 -0
  110. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/facades/__init__.py +0 -0
  111. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/facades/app.py +0 -0
  112. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/facades/config/__init__.py +0 -0
  113. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/facades/config/config_facade.py +0 -0
  114. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/facades/environment/__init__.py +0 -0
  115. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/facades/environment/environment_facade.py +0 -0
  116. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/facades/files/__init__.py +0 -0
  117. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/facades/files/path_facade.py +0 -0
  118. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/facades/log/__init__.py +0 -0
  119. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/facades/log/log_facade.py +0 -0
  120. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/facades/tests/__init__.py +0 -0
  121. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/facades/tests/tests_facade.py +0 -0
  122. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/patterns/__init__.py +0 -0
  123. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/patterns/singleton.py +0 -0
  124. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/pipelines/__init__.py +0 -0
  125. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/pipelines/cli_pipeline.py +0 -0
  126. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/providers/__init__.py +0 -0
  127. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/providers/config/__init__.py +0 -0
  128. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/providers/config/config_service_provider.py +0 -0
  129. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/providers/environment/__init__.py +0 -0
  130. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/providers/environment/environment__service_provider.py +0 -0
  131. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/providers/log/__init__.py +0 -0
  132. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/providers/log/log_service_provider.py +0 -0
  133. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/providers/service_provider.py +0 -0
  134. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/services/__init__.py +0 -0
  135. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/services/config/__init__.py +0 -0
  136. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/services/config/config_service.py +0 -0
  137. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/services/environment/__init__.py +0 -0
  138. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/services/environment/environment_service.py +0 -0
  139. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/services/files/__init__.py +0 -0
  140. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/services/files/path_resolver_service.py +0 -0
  141. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/services/log/__init__.py +0 -0
  142. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/support/dot_dict.py +0 -0
  143. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/support/exception_to_dict.py +0 -0
  144. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/support/reflection.py +0 -0
  145. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/support/std.py +0 -0
  146. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/test/__init__.py +0 -0
  147. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/test/exception.py +0 -0
  148. {orionis-0.77.0 → orionis-0.78.0}/orionis/luminate/test/unit_test.py +0 -0
  149. {orionis-0.77.0 → orionis-0.78.0}/orionis/static/ascii/icon.ascii +0 -0
  150. {orionis-0.77.0 → orionis-0.78.0}/orionis/static/ascii/info.ascii +0 -0
  151. {orionis-0.77.0 → orionis-0.78.0}/orionis/static/bg/galaxy.jpg +0 -0
  152. {orionis-0.77.0 → orionis-0.78.0}/orionis/static/favicon/OrionisFrameworkFavicon.png +0 -0
  153. {orionis-0.77.0 → orionis-0.78.0}/orionis/static/logos/OrionisFramework.jpg +0 -0
  154. {orionis-0.77.0 → orionis-0.78.0}/orionis/static/logos/OrionisFramework.png +0 -0
  155. {orionis-0.77.0 → orionis-0.78.0}/orionis/static/logos/OrionisFramework.psd +0 -0
  156. {orionis-0.77.0 → orionis-0.78.0}/orionis/static/logos/OrionisFramework2.png +0 -0
  157. {orionis-0.77.0 → orionis-0.78.0}/orionis/static/logos/OrionisFramework3.png +0 -0
  158. {orionis-0.77.0 → orionis-0.78.0}/orionis.egg-info/SOURCES.txt +0 -0
  159. {orionis-0.77.0 → orionis-0.78.0}/orionis.egg-info/dependency_links.txt +0 -0
  160. {orionis-0.77.0 → orionis-0.78.0}/orionis.egg-info/entry_points.txt +0 -0
  161. {orionis-0.77.0 → orionis-0.78.0}/orionis.egg-info/requires.txt +0 -0
  162. {orionis-0.77.0 → orionis-0.78.0}/orionis.egg-info/top_level.txt +0 -0
  163. {orionis-0.77.0 → orionis-0.78.0}/setup.cfg +0 -0
  164. {orionis-0.77.0 → orionis-0.78.0}/setup.py +0 -0
  165. {orionis-0.77.0 → orionis-0.78.0}/tests/__init__.py +0 -0
  166. {orionis-0.77.0 → orionis-0.78.0}/tests/tools/__init__.py +0 -0
  167. {orionis-0.77.0 → orionis-0.78.0}/tests/tools/class_example.py +0 -0
  168. {orionis-0.77.0 → orionis-0.78.0}/tests/tools/test_reflection.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orionis
3
- Version: 0.77.0
3
+ Version: 0.78.0
4
4
  Summary: Orionis Framework – Elegant, Fast, and Powerful.
5
5
  Home-page: https://github.com/orionis-framework/framework
6
6
  Author: Raul Mauricio Uñate Castro
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.77.0"
8
+ VERSION = "0.78.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -1,8 +1,9 @@
1
1
  from dataclasses import dataclass, field
2
- from typing import Any, Dict, Union
2
+ from datetime import time
3
+ from typing import Dict, Union
3
4
 
4
5
  @dataclass
5
- class Single:
6
+ class Stack:
6
7
  """
7
8
  Represents a single log file configuration.
8
9
 
@@ -17,7 +18,25 @@ class Single:
17
18
  """
18
19
  path: str
19
20
  level: str
20
- stream: bool
21
+
22
+
23
+ @dataclass
24
+ class Hourly:
25
+ """
26
+ Represents an hourly log file rotation configuration.
27
+
28
+ Attributes
29
+ ----------
30
+ path : str
31
+ The file path where hourly logs are stored.
32
+ level : str
33
+ The logging level (e.g., 'info', 'error', 'debug').
34
+ retention_hours : int
35
+ The number of hours to retain log files before deletion.
36
+ """
37
+ path: str
38
+ level: str
39
+ retention_hours: int
21
40
 
22
41
 
23
42
  @dataclass
@@ -31,15 +50,53 @@ class Daily:
31
50
  The file path where daily logs are stored.
32
51
  level : str
33
52
  The logging level (e.g., 'info', 'error', 'debug').
34
- days : int
53
+ retention_days : int
35
54
  The number of days to retain log files before deletion.
36
- stream : bool
37
- Whether to output logs to the console.
55
+ at_time : time
56
+ The time of day when the log rotation should occur.
57
+ """
58
+ path: str
59
+ level: str
60
+ retention_days: int
61
+ at: time
62
+
63
+
64
+ @dataclass
65
+ class Weekly:
66
+ """
67
+ Represents a weekly log file rotation configuration.
68
+
69
+ Attributes
70
+ ----------
71
+ path : str
72
+ The file path where weekly logs are stored.
73
+ level : str
74
+ The logging level (e.g., 'info', 'error', 'debug').
75
+ retention_weeks : int
76
+ The number of weeks to retain log files before deletion.
77
+ """
78
+ path: str
79
+ level: str
80
+ retention_weeks: int
81
+
82
+
83
+ @dataclass
84
+ class Monthly:
85
+ """
86
+ Represents a monthly log file rotation configuration.
87
+
88
+ Attributes
89
+ ----------
90
+ path : str
91
+ The file path where monthly logs are stored.
92
+ level : str
93
+ The logging level (e.g., 'info', 'error', 'debug').
94
+ retention_months : int
95
+ The number of months to retain log files before deletion.
38
96
  """
39
97
  path: str
40
98
  level: str
41
- days: int
42
- stream: bool
99
+ retention_months: int
43
100
 
44
101
 
45
102
  @dataclass
@@ -56,20 +113,16 @@ class Chunked:
56
113
  The file path where chunked logs are stored.
57
114
  level : str
58
115
  The logging level (e.g., 'info', 'error', 'debug').
59
- max_size : Union[int, str]
116
+ max_mb_size : Union[int, str]
60
117
  The maximum file size before creating a new chunk.
61
118
  Can be an integer (bytes) or a string (e.g., '10MB', '500KB').
62
119
  max_files : int
63
120
  The maximum number of log files to retain before older files are deleted.
64
- stream : bool
65
- Whether to output logs to the console.
66
121
  """
67
-
68
122
  path: str
69
123
  level: str
70
- max_size: Union[int, str] # Supports both numeric and formatted string sizes ('10MB')
71
- max_files: int # Ensures only a certain number of log files are kept
72
- stream: bool
124
+ mb_size: Union[int, str]
125
+ files: int
73
126
 
74
127
 
75
128
  @dataclass
@@ -86,9 +139,12 @@ class Channels:
86
139
  chunked : Chunked
87
140
  Configuration for chunked log file storage.
88
141
  """
89
- single: Single
90
- daily: Daily
91
- chunked: Chunked
142
+ stack = Stack
143
+ hourly = Hourly
144
+ daily = Daily
145
+ weekly = Weekly
146
+ monthly = Monthly
147
+ chunked = Chunked
92
148
 
93
149
 
94
150
  @dataclass
@@ -0,0 +1,251 @@
1
+ import logging
2
+ import os
3
+ import re
4
+ from datetime import datetime
5
+ from logging.handlers import RotatingFileHandler, TimedRotatingFileHandler
6
+ from pathlib import Path
7
+ from orionis.contracts.services.log.i_log_service import ILogguerService
8
+ from orionis.luminate.services.config.config_service import ConfigService
9
+
10
+ class LogguerService(ILogguerService):
11
+ """
12
+ A service class for logging messages with different severity levels.
13
+
14
+ This class initializes a logger that can write logs to a file. It supports
15
+ various log levels such as INFO, ERROR, SUCCESS, WARNING, and DEBUG.
16
+
17
+ Attributes
18
+ ----------
19
+ logger : logging.Logger
20
+ The logger instance used to log messages.
21
+
22
+ Methods
23
+ -------
24
+ __init__(config_service: ConfigService)
25
+ Initializes the logger with ConfigService
26
+ _initialize_logger(config_service: ConfigService)
27
+ Configures the logger with ConfigService settings.
28
+ info(message: str) -> None
29
+ Logs an informational message.
30
+ error(message: str) -> None
31
+ Logs an error message.
32
+ success(message: str) -> None
33
+ Logs a success message (treated as info).
34
+ warning(message: str) -> None
35
+ Logs a warning message.
36
+ debug(message: str) -> None
37
+ Logs a debug message.
38
+ """
39
+
40
+ def __init__(self, config_service : ConfigService):
41
+ """
42
+ Initializes the logger with the specified path, log level, and filename.
43
+
44
+ Parameters
45
+ ----------
46
+ config_service : ConfigService
47
+ The configuration service instance.
48
+ """
49
+ self.config_service = config_service
50
+ self._initialize_logger()
51
+
52
+ def _path_resolver(self, filename: str):
53
+ """
54
+ Resolves the log file path based on the specified filename.
55
+ """
56
+ base_path = Path(os.getcwd())
57
+ log_dir = base_path / "storage" / "logs"
58
+
59
+ # Create the log directory if it does not exist
60
+ if not log_dir.exists():
61
+ log_dir.mkdir(parents=True, exist_ok=True)
62
+
63
+ return log_dir / filename
64
+
65
+ def _initialize_logger(self):
66
+ """
67
+ Configures the logger with the specified settings.
68
+
69
+ This method sets up the logger to write logs to a file. If the specified
70
+ directory does not exist, it creates it. The log format includes the
71
+ timestamp and the log message.
72
+
73
+ Parameters
74
+ ----------
75
+ config_service : ConfigService
76
+ The configuration service instance.
77
+
78
+ Raises
79
+ ------
80
+ RuntimeError
81
+ If the logger cannot be initialized due to an error.
82
+ """
83
+ try:
84
+
85
+ channel : str = self.config_service.get("logging.default")
86
+ config : dict = self.config_service.get(f"logging.channels.{channel}", {})
87
+ path : str = config.get("path", 'logs/orionis.log')
88
+ app_timezone : str = self.config_service.get("app.timezone", "UTC")
89
+
90
+ if channel == "stack":
91
+
92
+ handlers = [
93
+ logging.FileHandler(
94
+ filename=self._path_resolver(path),
95
+ encoding="utf-8"
96
+ )
97
+ ]
98
+
99
+ elif channel == "hourly":
100
+
101
+ handlers = [
102
+ TimedRotatingFileHandler(
103
+ filename=self._path_resolver(path),
104
+ when="h",
105
+ interval=1,
106
+ backupCount=config.get('retention_hours', 24),
107
+ encoding="utf-8",
108
+ utc= True if app_timezone == "UTC" else False
109
+ )
110
+ ]
111
+
112
+ elif channel == "daily":
113
+
114
+ backup_count : str = config.get('retention_days', 30)
115
+ hour_at : str = config.get('at', "00:00")
116
+ if backup_count < 1 or not backup_count.isdigit():
117
+ raise ValueError("The 'retention_days' value must be an integer greater than 0.")
118
+ if not bool(re.match(r"^(?:[01]?\d|2[0-3]):[0-5]?\d$", hour_at)):
119
+ raise ValueError("The 'at' value must be a valid time in the format HH:MM.")
120
+
121
+ handlers = [
122
+ TimedRotatingFileHandler(
123
+ filename=self._path_resolver(path),
124
+ when="d",
125
+ interval=1,
126
+ backupCount=backup_count,
127
+ encoding="utf-8",
128
+ atTime=datetime.strptime(hour_at, "%H:%M").time(),
129
+ utc= True if app_timezone == "UTC" else False
130
+ )
131
+ ]
132
+
133
+ elif channel == "weekly":
134
+
135
+ backup_count : str = config.get('retention_weeks', 4)
136
+ if backup_count < 1 or not backup_count.isdigit():
137
+ raise ValueError("The 'retention_weeks' value must be an integer greater than 0.")
138
+ handlers = [
139
+ TimedRotatingFileHandler(
140
+ filename=self._path_resolver(path),
141
+ when="w0",
142
+ interval=1,
143
+ backupCount=backup_count,
144
+ encoding="utf-8",
145
+ utc= True if app_timezone == "UTC" else False
146
+ )
147
+ ]
148
+
149
+ elif channel == "monthly":
150
+
151
+ backup_count : str = config.get('retention_months', 2)
152
+ if backup_count < 1 or not backup_count.isdigit():
153
+ raise ValueError("The 'retention_months' value must be an integer greater than 0.")
154
+ handlers = [
155
+ TimedRotatingFileHandler(
156
+ filename=self._path_resolver(path),
157
+ when="midnight",
158
+ interval=30,
159
+ backupCount=backup_count,
160
+ encoding="utf-8",
161
+ utc= True if app_timezone == "UTC" else False
162
+ )
163
+ ]
164
+
165
+ elif channel == "chunked":
166
+
167
+ max_bytes : str = config.get('mb_size', 5).replace("MB", "")
168
+ if max_bytes < 1 or not max_bytes.isdigit():
169
+ raise ValueError("The 'mb_size' value must be an integer greater than 0.")
170
+ backup_count : str = config.get('max_files', 5)
171
+ if backup_count < 1 or not backup_count.isdigit():
172
+ raise ValueError("The 'max_files' value must be an integer greater than 0.")
173
+ handlers = [
174
+ RotatingFileHandler(
175
+ filename=self._path_resolver(path),
176
+ maxBytes= max_bytes * 1024 * 1024,
177
+ backupCount=backup_count,
178
+ encoding="utf-8"
179
+ )
180
+ ]
181
+
182
+
183
+ # Configure the logger
184
+ logging.basicConfig(
185
+ level=config.get("level", "INFO").upper(),
186
+ format="%(asctime)s - %(message)s",
187
+ datefmt="%Y-%m-%d %H:%M:%S",
188
+ encoding="utf-8",
189
+ handlers=handlers
190
+ )
191
+
192
+ # Get the logger instance
193
+ self.logger = logging.getLogger(__name__)
194
+
195
+ except Exception as e:
196
+ raise RuntimeError(f"Failed to initialize logger: {e}")
197
+
198
+ def info(self, message: str) -> None:
199
+ """
200
+ Logs an informational message.
201
+
202
+ Parameters
203
+ ----------
204
+ message : str
205
+ The message to log.
206
+ """
207
+ self.logger.info(f"[INFO] - {message}")
208
+
209
+ def error(self, message: str) -> None:
210
+ """
211
+ Logs an error message.
212
+
213
+ Parameters
214
+ ----------
215
+ message : str
216
+ The message to log.
217
+ """
218
+ self.logger.error(f"[ERROR] - {message}")
219
+
220
+ def success(self, message: str) -> None:
221
+ """
222
+ Logs a success message (treated as info).
223
+
224
+ Parameters
225
+ ----------
226
+ message : str
227
+ The message to log.
228
+ """
229
+ self.logger.info(f"[SUCCESS] - {message}")
230
+
231
+ def warning(self, message: str) -> None:
232
+ """
233
+ Logs a warning message.
234
+
235
+ Parameters
236
+ ----------
237
+ message : str
238
+ The message to log.
239
+ """
240
+ self.logger.warning(f"[WARNING] - {message}")
241
+
242
+ def debug(self, message: str) -> None:
243
+ """
244
+ Logs a debug message.
245
+
246
+ Parameters
247
+ ----------
248
+ message : str
249
+ The message to log.
250
+ """
251
+ self.logger.debug(f"[DEBUG] - {message}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orionis
3
- Version: 0.77.0
3
+ Version: 0.78.0
4
4
  Summary: Orionis Framework – Elegant, Fast, and Powerful.
5
5
  Home-page: https://github.com/orionis-framework/framework
6
6
  Author: Raul Mauricio Uñate Castro
@@ -1,159 +0,0 @@
1
- import os
2
- import logging
3
- from pathlib import Path
4
- from typing import Optional
5
- from orionis.contracts.services.log.i_log_service import ILogguerService
6
-
7
- class LogguerService(ILogguerService):
8
- """
9
- A service class for logging messages with different severity levels.
10
-
11
- This class initializes a logger that can write logs to a file. It supports
12
- various log levels such as INFO, ERROR, SUCCESS, WARNING, and DEBUG.
13
-
14
- Attributes
15
- ----------
16
- logger : logging.Logger
17
- The logger instance used to log messages.
18
-
19
- Methods
20
- -------
21
- __init__(path: Optional[str] = None, level: int = logging.INFO, filename: Optional[str] = 'orionis.log')
22
- Initializes the logger with the specified path, log level, and filename.
23
- _initialize_logger(path: Optional[str], level: int, filename: Optional[str] = 'orionis.log')
24
- Configures the logger with the specified settings.
25
- info(message: str) -> None
26
- Logs an informational message.
27
- error(message: str) -> None
28
- Logs an error message.
29
- success(message: str) -> None
30
- Logs a success message (treated as info).
31
- warning(message: str) -> None
32
- Logs a warning message.
33
- debug(message: str) -> None
34
- Logs a debug message.
35
- """
36
-
37
- def __init__(self, path: Optional[str] = None, level: int = logging.INFO, filename: Optional[str] = 'orionis.log'):
38
- """
39
- Initializes the logger with the specified path, log level, and filename.
40
-
41
- Parameters
42
- ----------
43
- path : Optional[str]
44
- The directory path where the log file will be stored. If not provided,
45
- it defaults to a 'logs' directory inside the 'storage' folder of the
46
- current working directory.
47
- level : int
48
- The logging level (e.g., logging.INFO, logging.ERROR). Defaults to logging.INFO.
49
- filename : Optional[str]
50
- The name of the log file. Defaults to 'orionis.log'.
51
- """
52
- self._initialize_logger(path, level, filename)
53
-
54
- def _initialize_logger(self, path: Optional[str], level: int, filename: Optional[str] = 'orionis.log'):
55
- """
56
- Configures the logger with the specified settings.
57
-
58
- This method sets up the logger to write logs to a file. If the specified
59
- directory does not exist, it creates it. The log format includes the
60
- timestamp and the log message.
61
-
62
- Parameters
63
- ----------
64
- path : Optional[str]
65
- The directory path where the log file will be stored.
66
- level : int
67
- The logging level (e.g., logging.INFO, logging.ERROR).
68
- filename : Optional[str]
69
- The name of the log file.
70
-
71
- Raises
72
- ------
73
- RuntimeError
74
- If the logger cannot be initialized due to an error.
75
- """
76
- try:
77
- # Resolve the log directory and file path
78
- if path is None:
79
- base_path = Path(os.getcwd())
80
- log_dir = base_path / "storage" / "logs"
81
-
82
- # Create the log directory if it does not exist
83
- if not log_dir.exists():
84
- log_dir.mkdir(parents=True, exist_ok=True)
85
-
86
- path = log_dir / filename
87
-
88
- # Configure the logger
89
- logging.basicConfig(
90
- level=level,
91
- format="%(asctime)s - %(message)s",
92
- datefmt="%Y-%m-%d %H:%M:%S",
93
- encoding="utf-8",
94
- handlers=[
95
- logging.FileHandler(path, encoding="utf-8")
96
- # logging.StreamHandler() # Uncomment to also log to the console
97
- ]
98
- )
99
-
100
- # Get the logger instance
101
- self.logger = logging.getLogger(__name__)
102
-
103
- except Exception as e:
104
- raise RuntimeError(f"Failed to initialize logger: {e}")
105
-
106
- def info(self, message: str) -> None:
107
- """
108
- Logs an informational message.
109
-
110
- Parameters
111
- ----------
112
- message : str
113
- The message to log.
114
- """
115
- self.logger.info(f"[INFO] - {message}")
116
-
117
- def error(self, message: str) -> None:
118
- """
119
- Logs an error message.
120
-
121
- Parameters
122
- ----------
123
- message : str
124
- The message to log.
125
- """
126
- self.logger.error(f"[ERROR] - {message}")
127
-
128
- def success(self, message: str) -> None:
129
- """
130
- Logs a success message (treated as info).
131
-
132
- Parameters
133
- ----------
134
- message : str
135
- The message to log.
136
- """
137
- self.logger.info(f"[SUCCESS] - {message}")
138
-
139
- def warning(self, message: str) -> None:
140
- """
141
- Logs a warning message.
142
-
143
- Parameters
144
- ----------
145
- message : str
146
- The message to log.
147
- """
148
- self.logger.warning(f"[WARNING] - {message}")
149
-
150
- def debug(self, message: str) -> None:
151
- """
152
- Logs a debug message.
153
-
154
- Parameters
155
- ----------
156
- message : str
157
- The message to log.
158
- """
159
- self.logger.debug(f"[DEBUG] - {message}")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes