MCPcopy Create free account
hub / github.com/FastMAS/KVCOMM / configure_logging

Function configure_logging

KVCOMM/utils/log.py:8–26  ·  view source on GitHub ↗

Configure the logging settings for the application. Args: print_level (str): The logging level for console output. logfile_level (str): The logging level for file output.

(
    print_level: str = "INFO",
    logfile_level: str = "DEBUG",
    log_path: Optional[Union[str, Path]] = None,
)

Source from the content-addressed store, hash-verified

6from KVCOMM.utils.const import KVCOMM_ROOT
7
8def configure_logging(
9 print_level: str = "INFO",
10 logfile_level: str = "DEBUG",
11 log_path: Optional[Union[str, Path]] = None,
12) -> None:
13 """
14 Configure the logging settings for the application.
15
16 Args:
17 print_level (str): The logging level for console output.
18 logfile_level (str): The logging level for file output.
19 """
20 logger.remove()
21 logger.add(sys.stderr, level=print_level)
22 target_path = Path(log_path) if log_path is not None else KVCOMM_ROOT / 'logs/log.txt'
23 if target_path.is_dir():
24 target_path = target_path / "log.txt"
25 target_path.parent.mkdir(parents=True, exist_ok=True)
26 logger.add(target_path, level=logfile_level, rotation="10 MB")
27
28def initialize_log_file(experiment_name: str, time_stamp: str) -> Path:
29 """

Callers 5

mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected