|
5 | 5 | import logging |
6 | 6 | import os |
7 | 7 | from logging import Logger |
| 8 | +from pathlib import Path |
8 | 9 | from typing import Any, Optional |
9 | 10 |
|
10 | 11 | import dotenv |
@@ -41,12 +42,34 @@ def __init__( |
41 | 42 |
|
42 | 43 | self._indent = indent |
43 | 44 |
|
| 45 | + @property |
| 46 | + def file_path(self) -> Path: |
| 47 | + """ |
| 48 | + Get the path to the JSON file. |
| 49 | +
|
| 50 | + Returns: |
| 51 | + Path: The file path. |
| 52 | + """ |
| 53 | + return self._map_template.file_path |
| 54 | + |
44 | 55 | @property |
45 | 56 | def keys(self) -> list[str]: |
| 57 | + """ |
| 58 | + Get a list of all keys in the mapping. |
| 59 | +
|
| 60 | + Returns: |
| 61 | + list[str]: A list of keys in the mapping. |
| 62 | + """ |
46 | 63 | return self._map_template.keys |
47 | 64 |
|
48 | 65 | @property |
49 | 66 | def data(self) -> JSONMap: |
| 67 | + """ |
| 68 | + Get the underlying JSON data structure. |
| 69 | +
|
| 70 | + Returns: |
| 71 | + JSONData (Union[JSONMap, JSONList]): The underlying data structure. |
| 72 | + """ |
50 | 73 | return self._map_template.data |
51 | 74 |
|
52 | 75 | def mkdir(self) -> None: |
@@ -308,9 +331,7 @@ def get_logger( |
308 | 331 | "%(asctime)s - %(filename)s:%(lineno)d - %(levelname)s - %(message)s" |
309 | 332 | ) |
310 | 333 |
|
311 | | - default_log_dir = "/var/log/jsonpycraft/" # Default log directory |
312 | | - log_file_path = self.evaluate_path(key, default_log_dir) |
313 | | - |
| 334 | + log_file_path = self.evaluate_path(key, "/var/log/jsonpycraft/") |
314 | 335 | log_level = log_info.get("level", level) |
315 | 336 | logger = logging.getLogger(logger_name) |
316 | 337 |
|
|
0 commit comments