bear-utils 0.9.3__tar.gz → 0.9.4__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.
- {bear_utils-0.9.3 → bear_utils-0.9.4}/PKG-INFO +1 -1
- bear_utils-0.9.4/src/bear_utils/_internal/_version.py +1 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/constants/_meta.py +2 -4
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/graphics/font/__init__.py +0 -1
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/graphics/font/_utils.py +0 -3
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/_log_level.py +8 -8
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/fastapi_logger.py +6 -7
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/simple_logger.py +19 -13
- bear_utils-0.9.3/src/bear_utils/_internal/_version.py +0 -1
- {bear_utils-0.9.3 → bear_utils-0.9.4}/.gitignore +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/.python-version +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/AGENTS.md +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/README.md +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/config/coverage.ini +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/config/default.toml +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/config/git-changelog.toml +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/config/pytest.ini +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/config/ruff.toml +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/directory_structure.txt +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/directory_structure.xml +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/maskfile.md +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/noxfile.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/pyproject.toml +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/__main__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/_internal/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/_internal/cli.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/_internal/debug.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/ai/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/ai/ai_helpers/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/ai/ai_helpers/_common.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/ai/ai_helpers/_config.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/ai/ai_helpers/_parsers.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/ai/ai_helpers/_types.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/cache/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/cli/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/cli/_args.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/cli/_get_version.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/cli/commands.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/cli/prompt_helpers.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/cli/shell/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/cli/shell/_base_command.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/cli/shell/_base_shell.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/cli/shell/_common.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/cli/typer_bridge.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/config/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/config/config_manager.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/config/dir_manager.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/config/settings_manager.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/constants/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/constants/_exceptions.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/constants/_exit_code.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/constants/_http_status_code.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/constants/_lazy_typing.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/constants/date_related.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/constants/time_related.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/database/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/database/_db_manager.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/events/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/events/events_class.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/events/events_module.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/extras/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/extras/_async_helpers.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/extras/_tools.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/extras/_zapper.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/extras/platform_utils.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/extras/responses/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/extras/responses/function_response.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/extras/wrappers/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/extras/wrappers/add_methods.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/extras/wrappers/string_io.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/files/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/files/file_handlers/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/files/file_handlers/_base_file_handler.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/files/file_handlers/file_handler_factory.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/files/file_handlers/json_file_handler.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/files/file_handlers/log_file_handler.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/files/file_handlers/toml_file_handler.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/files/file_handlers/txt_file_handler.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/files/file_handlers/yaml_file_handler.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/files/ignore_parser.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/graphics/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/graphics/bear_gradient.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/graphics/font/_raw_block_letters.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/graphics/font/_theme.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/graphics/font/block_font.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/graphics/font/glitch_font.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/graphics/image_helpers.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/gui/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/gui/gui_tools/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/gui/gui_tools/_settings.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/gui/gui_tools/_types.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/gui/gui_tools/qt_app.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/gui/gui_tools/qt_color_picker.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/gui/gui_tools/qt_file_handler.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/gui/gui_tools/qt_input_dialog.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/_common.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/_console_junk.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/_styles.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/logger_protocol.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/_console.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/_level_sin.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/_logger.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/base_logger.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/base_logger.pyi +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/basic_logger/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/basic_logger/logger.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/basic_logger/logger.pyi +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/buffer_logger.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/console_logger.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/console_logger.pyi +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/file_logger.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/sub_logger.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/sub_logger.pyi +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/monitoring/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/monitoring/_common.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/monitoring/host_monitor.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/time/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/tests/__init__.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/tests/test_add_ord_suffix.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/tests/test_clipboard.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/tests/test_database_manager.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/tests/test_default_shell.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/tests/test_font_utils.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/tests/test_function_response.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/tests/test_gradient.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/tests/test_logger.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/tests/test_platform_utils.py +0 -0
- {bear_utils-0.9.3 → bear_utils-0.9.4}/tests/test_prompt_helpers.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: bear-utils
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.4
|
4
4
|
Summary: Various utilities for Bear programmers, including a rich logging utility, a disk cache, and a SQLite database wrapper amongst other things.
|
5
5
|
Author-email: chaz <bright.lid5647@fastmail.com>
|
6
6
|
Requires-Python: >=3.12
|
@@ -0,0 +1 @@
|
|
1
|
+
version = "0.9.4"
|
@@ -29,10 +29,9 @@ class RichStrEnum(StrEnum):
|
|
29
29
|
default: str
|
30
30
|
|
31
31
|
def __new__(cls, value: StrValue) -> Self:
|
32
|
-
text: str = value.text
|
33
32
|
obj: Self = str.__new__(cls, value.value)
|
34
33
|
obj._value_ = value.value
|
35
|
-
obj.text = text
|
34
|
+
obj.text = value.text
|
36
35
|
obj.default = value.default
|
37
36
|
return obj
|
38
37
|
|
@@ -91,10 +90,9 @@ class RichIntEnum(IntEnum):
|
|
91
90
|
default: int
|
92
91
|
|
93
92
|
def __new__(cls, value: IntValue) -> Self:
|
94
|
-
text: str = value.text
|
95
93
|
obj: Self = int.__new__(cls, value.value)
|
96
94
|
obj._value_ = value.value
|
97
|
-
obj.text = text
|
95
|
+
obj.text = value.text
|
98
96
|
obj.default = value.default
|
99
97
|
return obj
|
100
98
|
|
@@ -16,14 +16,14 @@ NOTSET: Literal[0] = 0
|
|
16
16
|
class LogLevel(RichIntEnum):
|
17
17
|
"""Enumeration for logging levels."""
|
18
18
|
|
19
|
-
NOTSET = Value(NOTSET, "NOTSET")
|
20
|
-
VERBOSE = Value(VERBOSE, "VERBOSE")
|
21
|
-
DEBUG = Value(DEBUG, "DEBUG")
|
22
|
-
INFO = Value(INFO, "INFO")
|
23
|
-
WARNING = Value(WARNING, "WARNING")
|
24
|
-
ERROR = Value(ERROR, "ERROR")
|
25
|
-
FAILURE = Value(FAILURE, "FAILURE")
|
26
|
-
SUCCESS = Value(SUCCESS, "SUCCESS")
|
19
|
+
NOTSET = Value(NOTSET, "NOTSET", default=NOTSET)
|
20
|
+
VERBOSE = Value(VERBOSE, "VERBOSE", default=VERBOSE)
|
21
|
+
DEBUG = Value(DEBUG, "DEBUG", default=DEBUG)
|
22
|
+
INFO = Value(INFO, "INFO", default=INFO)
|
23
|
+
WARNING = Value(WARNING, "WARNING", default=WARNING)
|
24
|
+
ERROR = Value(ERROR, "ERROR", default=ERROR)
|
25
|
+
FAILURE = Value(FAILURE, "FAILURE", default=FAILURE)
|
26
|
+
SUCCESS = Value(SUCCESS, "SUCCESS", default=SUCCESS)
|
27
27
|
|
28
28
|
|
29
29
|
level_to_name = {
|
{bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/fastapi_logger.py
RENAMED
@@ -45,7 +45,7 @@ class LogRequest(BaseModel):
|
|
45
45
|
@field_serializer("level")
|
46
46
|
def serialize_level(self, value: LogLevel | int | str) -> int:
|
47
47
|
"""Serialize the log level to an integer."""
|
48
|
-
return LogLevel.get(value).value
|
48
|
+
return LogLevel.get(value, default=DEBUG).value
|
49
49
|
|
50
50
|
|
51
51
|
class LoggingServer[T: TextIO](SingletonBase):
|
@@ -65,7 +65,7 @@ class LoggingServer[T: TextIO](SingletonBase):
|
|
65
65
|
self.port: int = port
|
66
66
|
self.log_file: Path = Path(log_file)
|
67
67
|
self.log_file.parent.mkdir(parents=True, exist_ok=True)
|
68
|
-
self.level: LogLevel = LogLevel.get(level)
|
68
|
+
self.level: LogLevel = LogLevel.get(level, default=DEBUG)
|
69
69
|
self.app = FastAPI()
|
70
70
|
self.server_thread = None
|
71
71
|
self._running = False
|
@@ -111,7 +111,7 @@ class LoggingServer[T: TextIO](SingletonBase):
|
|
111
111
|
args=request["args"] if isinstance(request, dict) else request.args,
|
112
112
|
kwargs=request["kwargs"] if isinstance(request, dict) else request.kwargs,
|
113
113
|
)
|
114
|
-
level: LogLevel = LogLevel.get(request.level)
|
114
|
+
level: LogLevel = LogLevel.get(request.level, default=DEBUG)
|
115
115
|
if level.value < self.level.value:
|
116
116
|
return self.response(status="ignored", message="Log level is lower than server's minimum level")
|
117
117
|
message = request.message
|
@@ -137,7 +137,6 @@ class LoggingServer[T: TextIO](SingletonBase):
|
|
137
137
|
level: LogLevel,
|
138
138
|
message: str,
|
139
139
|
end: str = "\n",
|
140
|
-
console: bool = True,
|
141
140
|
*args,
|
142
141
|
**kwargs,
|
143
142
|
) -> ExitCode:
|
@@ -152,7 +151,7 @@ class LoggingServer[T: TextIO](SingletonBase):
|
|
152
151
|
if kwargs:
|
153
152
|
for key, value in kwargs.items():
|
154
153
|
buffer.append(f"{key}={value}{end}")
|
155
|
-
if console:
|
154
|
+
if kwargs.pop("console", False):
|
156
155
|
self.print(f"{end}".join(buffer))
|
157
156
|
with open(self.log_file, "a", encoding="utf-8") as f:
|
158
157
|
for line in buffer:
|
@@ -207,14 +206,14 @@ class LoggingClient[T: TextIO]:
|
|
207
206
|
server_url: str | None = None,
|
208
207
|
host: str = "http://localhost",
|
209
208
|
port: int = 8080,
|
210
|
-
level: LogLevel | int | str =
|
209
|
+
level: LogLevel | int | str = DEBUG,
|
211
210
|
file: T = DEVNULL, # Default to DEVNULL to discard console output
|
212
211
|
) -> None:
|
213
212
|
"""Initialize the ServerLogger."""
|
214
213
|
self.host: str = host
|
215
214
|
self.port: int = port
|
216
215
|
self.server_url: str = server_url or f"{self.host}:{self.port}"
|
217
|
-
self.level: LogLevel = LogLevel.get(level)
|
216
|
+
self.level: LogLevel = LogLevel.get(level, default=DEBUG)
|
218
217
|
self.client: AsyncClient = AsyncClient(timeout=5.0)
|
219
218
|
self.file: T = file
|
220
219
|
|
{bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/simple_logger.py
RENAMED
@@ -3,19 +3,17 @@
|
|
3
3
|
from io import StringIO
|
4
4
|
from typing import TextIO
|
5
5
|
|
6
|
-
from bear_utils.constants import STDERR, STDOUT
|
6
|
+
from bear_utils.constants import STDERR, STDOUT, NullFile
|
7
7
|
from bear_utils.logger_manager._log_level import LogLevel
|
8
8
|
from bear_utils.time import EpochTimestamp
|
9
9
|
|
10
|
-
VERBOSE: LogLevel = LogLevel.
|
11
|
-
DEBUG: LogLevel = LogLevel.
|
12
|
-
INFO: LogLevel = LogLevel.
|
13
|
-
WARNING: LogLevel = LogLevel.
|
14
|
-
ERROR: LogLevel = LogLevel.
|
15
|
-
SUCCESS: LogLevel = LogLevel.
|
16
|
-
FAILURE: LogLevel = LogLevel.
|
17
|
-
|
18
|
-
CHOICES = [STDOUT, STDERR, StringIO]
|
10
|
+
VERBOSE: LogLevel = LogLevel.VERBOSE
|
11
|
+
DEBUG: LogLevel = LogLevel.DEBUG
|
12
|
+
INFO: LogLevel = LogLevel.INFO
|
13
|
+
WARNING: LogLevel = LogLevel.WARNING
|
14
|
+
ERROR: LogLevel = LogLevel.ERROR
|
15
|
+
SUCCESS: LogLevel = LogLevel.SUCCESS
|
16
|
+
FAILURE: LogLevel = LogLevel.FAILURE
|
19
17
|
|
20
18
|
|
21
19
|
class SimpleLogger[T: TextIO]:
|
@@ -23,8 +21,8 @@ class SimpleLogger[T: TextIO]:
|
|
23
21
|
|
24
22
|
def __init__(self, level: str | int | LogLevel = "DEBUG", file: T = STDERR) -> None:
|
25
23
|
"""Initialize the logger with a minimum log level and output file."""
|
26
|
-
self.level: LogLevel = LogLevel.get(level)
|
27
|
-
self.file: T = file
|
24
|
+
self.level: LogLevel = LogLevel.get(level, default=DEBUG)
|
25
|
+
self.file: T = file # Can be STDOUT, STDERR, StringIO, NullFile or other TextIO Objects
|
28
26
|
self.buffer: list[str] = []
|
29
27
|
|
30
28
|
def print(self, msg: object, end: str = "\n") -> None:
|
@@ -80,10 +78,18 @@ class SimpleLogger[T: TextIO]:
|
|
80
78
|
self.log(FAILURE, msg, *args, **kwargs)
|
81
79
|
|
82
80
|
|
81
|
+
__all__ = [
|
82
|
+
"STDERR",
|
83
|
+
"STDOUT",
|
84
|
+
"LogLevel",
|
85
|
+
"NullFile",
|
86
|
+
"SimpleLogger",
|
87
|
+
]
|
88
|
+
|
83
89
|
# Example usage:
|
84
90
|
if __name__ == "__main__":
|
85
91
|
logger = SimpleLogger(file=StringIO())
|
86
|
-
logger_two = SimpleLogger(level="INFO", file=
|
92
|
+
logger_two = SimpleLogger(level="INFO", file=NullFile())
|
87
93
|
logger.info(msg="This is an info message")
|
88
94
|
logger_two.info(msg="This is an info message")
|
89
95
|
|
@@ -1 +0,0 @@
|
|
1
|
-
version = "0.9.3"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/files/file_handlers/_base_file_handler.py
RENAMED
File without changes
|
{bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/files/file_handlers/file_handler_factory.py
RENAMED
File without changes
|
{bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/files/file_handlers/json_file_handler.py
RENAMED
File without changes
|
{bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/files/file_handlers/log_file_handler.py
RENAMED
File without changes
|
{bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/files/file_handlers/toml_file_handler.py
RENAMED
File without changes
|
{bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/files/file_handlers/txt_file_handler.py
RENAMED
File without changes
|
{bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/files/file_handlers/yaml_file_handler.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/basic_logger/__init__.py
RENAMED
File without changes
|
{bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/basic_logger/logger.py
RENAMED
File without changes
|
{bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/basic_logger/logger.pyi
RENAMED
File without changes
|
{bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/buffer_logger.py
RENAMED
File without changes
|
{bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/console_logger.py
RENAMED
File without changes
|
{bear_utils-0.9.3 → bear_utils-0.9.4}/src/bear_utils/logger_manager/loggers/console_logger.pyi
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|