MCPcopy Create free account
hub / github.com/PabloLec/RecoverPy / _set_logger

Function _set_logger

recoverpy/__init__.py:13–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11
12
13def _set_logger() -> None:
14 global log
15
16 parser = argparse.ArgumentParser()
17 parser.add_argument("-d", "--debug", action="store_true", help="Enable logging")
18
19 args = parser.parse_args()
20 timestamp = datetime.now().strftime("%Y%m%d-%H%M%S")
21 log_file_path = path.join(gettempdir(), f"recoverpy-{timestamp}.log")
22
23 logging.basicConfig(
24 level=logging.DEBUG if args.debug else logging.CRITICAL,
25 format="%(asctime)s - %(levelname)s - [%(threadName)s] - %(message)s",
26 handlers=(
27 [logging.FileHandler(log_file_path)]
28 if args.debug
29 else [logging.NullHandler()]
30 ),
31 )
32 log = logging.getLogger()
33
34
35def main() -> None:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected