Skip to content

Commit 64630b7

Browse files
committed
fix: Rename config_file_path to config_path in LoggerLoader for consistency
1 parent 0660740 commit 64630b7

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

src/beans_logging/_core.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ class LoggerLoader:
2929
Attributes:
3030
_CONFIG_PATH (str): Default config file path. Default is '${PWD}/configs/logger.yml'.
3131
32-
handlers_map (dict[str, int]): Map of handler names to their IDs. Default is {'default.loguru_handler': 0}.
33-
config (LoggerConfigPM): Main logger configuration model. Default is LoggerConfigPM().
34-
config_file_path (str ): Path to logger configuration file. Default is _CONFIG_PATH.
32+
handlers_map (dict[str, int]): Map of handler names to their IDs. Default is {'default.loguru_handler': 0}.
33+
config (LoggerConfigPM): Main logger configuration model. Default is LoggerConfigPM().
34+
config_path (str ): Path to logger configuration file. Default is _CONFIG_PATH.
3535
3636
Methods:
3737
load() : Load logger handlers based on logger config.
@@ -253,40 +253,40 @@ def config(self, config: LoggerConfigPM | dict[str, Any]) -> None:
253253

254254
# config
255255

256-
# config_file_path
256+
# config_path
257257
@property
258-
def config_file_path(self) -> str:
258+
def config_path(self) -> str:
259259
try:
260-
return self.__config_file_path
260+
return self.__config_path
261261
except AttributeError:
262-
self.__config_file_path = LoggerLoader._CONFIG_PATH
262+
self.__config_path = LoggerLoader._CONFIG_PATH
263263

264-
return self.__config_file_path
264+
return self.__config_path
265265

266-
@config_file_path.setter
267-
def config_file_path(self, config_file_path: str) -> None:
268-
if not isinstance(config_file_path, str):
266+
@config_path.setter
267+
def config_path(self, config_path: str) -> None:
268+
if not isinstance(config_path, str):
269269
raise TypeError(
270-
f"`config_file_path` attribute type {type(config_file_path)} is invalid, must be a <str>!"
270+
f"`config_path` attribute type {type(config_path)} is invalid, must be a <str>!"
271271
)
272272

273-
config_file_path = config_file_path.strip()
274-
if config_file_path == "":
275-
raise ValueError("`config_file_path` attribute value is empty!")
273+
config_path = config_path.strip()
274+
if config_path == "":
275+
raise ValueError("`config_path` attribute value is empty!")
276276

277277
if (
278-
(not config_file_path.lower().endswith((".yml", ".yaml")))
279-
and (not config_file_path.lower().endswith(".json"))
280-
and (not config_file_path.lower().endswith(".toml"))
278+
(not config_path.lower().endswith((".yml", ".yaml")))
279+
and (not config_path.lower().endswith(".json"))
280+
and (not config_path.lower().endswith(".toml"))
281281
):
282282
raise ValueError(
283-
f"`config_file_path` attribute value '{config_file_path}' is invalid, "
283+
f"`config_path` attribute value '{config_path}' is invalid, "
284284
f"file must be '.yml', '.yaml', '.json' or '.toml' format!"
285285
)
286286

287-
self.__config_file_path = config_file_path
287+
self.__config_path = config_path
288288

289-
# config_file_path
289+
# config_path
290290
# ATTRIBUTES
291291

292292

tests/test_beans_logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_init(logger: Logger, logger_loader: LoggerLoader):
2626

2727
assert isinstance(logger_loader, LoggerLoader)
2828
assert logger_loader.handlers_map == {"default.loguru_handler": 0}
29-
assert logger_loader.config_file_path == LoggerLoader._CONFIG_PATH
29+
assert logger_loader.config_path == LoggerLoader._CONFIG_PATH
3030
assert isinstance(logger_loader.config, LoggerConfigPM)
3131

3232
logger.success("Done: Initialization of 'LoggerLoader'.\n")

0 commit comments

Comments
 (0)